Forum Discussion
Grouping a Calculated Measure
Hi vbaskar,
According to your description, my understanding is that you want to group the measure result. Please refer to the following sample:
I have a table like this:
Then I create a table used to display the Category:
After that, we can create a measure like below:
Count of Service = var a = ADDCOLUMNS(Data, "weeks", SWITCH(DATEDIFF(Data[Start Date],Data[End Date],WEEK),0,"0-1 Week",1,"1-2 Weeks",2,"2-3 Weeks",3,"3-4 Weeks","> 4 Weeks")) return SUMX(a,IF([weeks] = MIN(Category[Category]),1,0))
Then drag the measure and the ‘category’[category] to the table visual, the result will like below:
Best Regards,
Teige
Thanks, TeigeGao! That's exactly what I wanted to do.
By any chance, can you bring about this solution without creating a new table to display the category? We will be giving PowerBI datasets access to different teams within my company and I'd like to encourage them to write their own measures without doing a calculated column or a new table. I can add a table on the backend this time, but going forward if anyone wants to create a new measure and then group it, I am looking to see if there is a way. Thanks again for your help.