Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Saloni_Gupta
Helper I
Helper I

Histograms to work with Group By Slicer

Hi All,

I have a Dimension table which has Client, Product and Job Id columns and I have a fact table which has my measures as (Revenue-Actual,Revenue-Budget,Revenue per hour-Actual, Revenue per hour-Budget, etc) at job level.

My requirement is to create histograms group by either Client or Product for Variance to Budget measures.
So, I need to create the bins and show the count of either client/product depending upon the user selection.

Saloni_Gupta_0-1711475342714.png

 

I have not shown the bins here because they can change according to the group by slicer or by different measures (Revenue, Revenue per hour, Cost per hour). Bins should see the min and max values of each measure and generate accordingly (not necessary to create using groups).

Saloni_Gupta_0-1711475419741.png

My approach would be to create a summarize table which would check user selection(on Group By) and aggregate the Variance measure accordingly, then based on this aggregated Variance - it should create the bins and count the number of Clients/Product falling in those bins.


Please let me know if you need more details.

Thanks in Advance!

 

2 REPLIES 2
v-kaiyue-msft
Community Support
Community Support

Hi @Saloni_Gupta ,

 

1. Create the calculation table and get the column names in the table.

Table 2 = {"Client", "Product"}

vkaiyuemsft_0-1711526931623.png


2. Create the field parameters.

vkaiyuemsft_1-1711526953743.png

 

vkaiyuemsft_2-1711526953744.png

 

3. Create measure.

Measure =
VAR _newvalue = SELECTEDVALUE('Table 2'[Value])
VAR _newcolumn =
SWITCH(
_newvalue.
"Client",SELECTEDVALUE('Table'[Client]),
"Product",MAX('Table'[Product])
)
RETURN CALCULATE(SUM('Table'[Variance-Revenue]),FILTER(ALLSELECTED('Table'),'Table'[Client]=_newcolumn||'Table'[Product]=_newcolumn ))

vkaiyuemsft_3-1711526987181.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-kaiyue-msft ,
Thanks for replying on this post. 
I have exactly same tables (like Table2 and the one using Fields and parameter):

Saloni_Gupta_0-1711931158814.png

 

Now, to create histograms I am creating a measure which would generate x-axis (as mentioned in my question)

1) Histogram X-axis Value =
var _t = SUMMARIZE'DimBudgetToActuals' ,'DimBudgetToActuals'[Client] , "sumvariance" , [Variance to Budget - Revenue ($)])
var _max_value = MAXX(_t,[sumvariance])
var _min_value =  MINX(_t , [sumvariance])
return
GENERATESERIES(_min_value,_max_value,952055)

Can you suggest me how to use the above dynamic Client/Product selection in this measure as I am creating a Summarize table. Basically, If user selects Client in the slicer, it should summarize Variance Revenue by Client and then generateseries accordingly or else with the Product. Can you show me how its done using Summarize dax?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.