The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
My data table is something like:
Im asked to get a table/histogram with a row/bar per month and the number of IDs per range of summatory of hours/month:
Here is an intermediate table to help you guys understand the requirement:
Is it possible to get it with just with measures/DAX and not having to create the intermediate tale in the data model??
Thanks a lot in advance!
Solved! Go to Solution.
Hi @TSGD2123 ,
Like this?
I created four measures to achieve this goal, as the following show:
judgement = IF([sum hours]<10,0,IF([sum hours]>=10&&[sum hours]<20,1,IF([sum hours]>=20&&[sum hours]<30,2)))
sum hours<10 = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),[judgement]=0&&'Table'[Month]=SELECTEDVALUE('Table'[Month])))
10-sumhours-20 = var _t=SUMMARIZE('Table','Table'[Month],'Table'[ID])
return COUNTROWS(FILTER(_t,[judgement]=1))
sum hours>20 = var _t=SUMMARIZE('Table','Table'[Month],'Table'[ID])
return COUNTROWS(FILTER(_t,[judgement]=2))
The related pbix file I also attached, you can refer for better understanding.
Best regards,
Community Support Team Selina zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @TSGD2123 ,
Like this?
I created four measures to achieve this goal, as the following show:
judgement = IF([sum hours]<10,0,IF([sum hours]>=10&&[sum hours]<20,1,IF([sum hours]>=20&&[sum hours]<30,2)))
sum hours<10 = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),[judgement]=0&&'Table'[Month]=SELECTEDVALUE('Table'[Month])))
10-sumhours-20 = var _t=SUMMARIZE('Table','Table'[Month],'Table'[ID])
return COUNTROWS(FILTER(_t,[judgement]=1))
sum hours>20 = var _t=SUMMARIZE('Table','Table'[Month],'Table'[ID])
return COUNTROWS(FILTER(_t,[judgement]=2))
The related pbix file I also attached, you can refer for better understanding.
Best regards,
Community Support Team Selina zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Yes. It's possible.
Great! Could you go into further detail?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
19 | |
18 | |
18 | |
14 |
User | Count |
---|---|
36 | |
35 | |
20 | |
20 | |
17 |