Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi PBI community, Im new in DAX and I hope you can help me
I have 3 tables, A SellOut table, a Information Company Table and a Calendar Table
I've created a measure with switch:
Classification = SWITCH(TRUE(),
[%Avrg]>=0.8,"A",
[%Avrg]>=0.6,"B",
[%Avrg]<0.6,"C",
"Otro")
Then I put in a matrix visualization and works well but I need to count the Classification and put it in a pie chart
| Company | %Avrg | Classification |
| Store1 | 0.9 | A |
| Store2 | 0.5 | C |
| Store3 | 0.4 | C |
So I tried to put that measure as a column but it give me incorrect results
The measure %Avrg
%Avrg= CALCULATE(DIVIDE([Actual_Month_Avrg],[Last_Month_Avrg],1))
Actual_Month_Avrg= CALCULATE(DIVIDE([Sales],[Days_Use]))
Last_Month_Avrg= CALCULATE(DIVIDE([Sales],[Days_Use]),DATEADD(CalendarTable[Date],-1,MONTH))
Sales= Sum(Sell_Out[Sales])
Days_Use= DISTINCTCOUNT(Sell_Out[Date])
thanks in advance
Hi @oromerot ,
You can create a table2 like :
Then you can use the following measure to count Classification:
Measure =
CALCULATE (
DISTINCTCOUNT ( Table[Company] ),
FILTER ( Table, [Classification] = MAX ( Table2[Classification] ) )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
@oromerot , Create a table class with three values A,B,C, you can create using enter data.
then try a measure like
measure =
var _cal =Classification = SWITCH(TRUE(),
[%Avrg]>=0.8,"A",
[%Avrg]>=0.6,"B",
[%Avrg]<0.6,"C",
"Otro")
return
calculate(countrows(Table[Company]), values(Table[Company]) filter(Table, _cal = max(class[Class])))
refer these
https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-po...
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization
https://radacad.com/dynamic-banding-or-grouping-in-power-bi-using-dax-measures-choose-the-size-of-bi...
https://www.credera.com/blog/technology-solutions/creating-aging-report-using-a-user-selected-date-i...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 60 | |
| 44 | |
| 40 | |
| 37 | |
| 21 |
| User | Count |
|---|---|
| 178 | |
| 127 | |
| 116 | |
| 77 | |
| 54 |