powerbi

How do I create a bar plot histogram of a parameter in power BI


I'm trying to create basic descriptive visualizations for my dataframe, such as histograms, but since there are a lot of variables I'd like to make 4 histograms for which you can select the display variable.

My usual approach to a histogram is a clustered bar plot where x-axis is the variable and y-axis is the variable count.

I've tried to make the same thing with a field parameter:

Create a field parameter of single selection, with all possible numeric variables, "VAR" -> Put "VAR" as x and y axis in a clustered bar plot.

This, however, yields an empty plot, and I don't have the count option for the field variable (or any other basic operation).

Here is some dummy data:

VarA VarB VarC
4 6 673
22 5 774
64 0 672
62 5 335
29 3 850
27 9 202
56 2 305
100 0 383
32 5 545
22 9 1000
86 7 170
95 9 91
35 8 995
30 4 51
53 7 802
88 8 321

And here is what I've tried to do with the data: On the left are the 3 individual "histograms" (yes they look bad but that's another whole issue), and on the right a clustered bar plot with its x and y variables as "FIELD PARAMETER", the field parameter I created (also on the right). As you can see, it yields a blank plot. enter image description here


Solution

  • Create a Measure similar to:

    # rows = COUNTROWS(YourTable)
    

    Use this for your Y-axis, and the Field Parameter for your X-axis.

    Example