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
kilala
Resolver I
Resolver I

Calculate Category Created in Measure by ID no

Hello all,

I have created a measure to categorise certain condition on my data. The condition is by ID no.

For example;

IDAmount AAmount BAmount CCategory
110000A
2100500B
31001000B
4100100100C

 

I want to display the SUMMARY of count by category with pie chart (if possible). so in my pie chart later, I would have 3 category and value as below:
CAT A -1

CAT B -2

CAT C- 1

 

how do i do that?

Is it possible/ is there any other alternative i can opt to?

 

Thanks!

1 ACCEPTED SOLUTION
kilala
Resolver I
Resolver I

Hi all,

Thanks for helping.

 

I think current problem is that the category is measure.

So, I create a table contains all ID and then create conditional column "Category". So, later i just drag the ID and Category together.

 

It solve my problem as of now, hopefully there wont be any issue later hehe.

View solution in original post

7 REPLIES 7
kilala
Resolver I
Resolver I

Hi all,

Thanks for helping.

 

I think current problem is that the category is measure.

So, I create a table contains all ID and then create conditional column "Category". So, later i just drag the ID and Category together.

 

It solve my problem as of now, hopefully there wont be any issue later hehe.

v-rongtiep-msft
Community Support
Community Support

Hi @kilala ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure = CALCULATE(COUNT('Table'[Category]),FILTER(ALL('Table'),'Table'[Category]=SELECTEDVALUE('Table'[Category])))

vpollymsft_0-1649211071425.png

If I have misunderstood your meaning, please provide your desired output with a screenshot.

 

Best Regards

Community Support Team _ Polly

 

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

amitchandak
Super User
Super User

@kilala , You can create pie visual, Drag Categoryto legend, and count to ID to values.

 

In case you need cat appended you need to create a new column

 

Cate New =  "CAT " & [Category]

 

 

You can also have measure to be used in values

count = count(Table[ID])

Dear @amitchandak ,

When I drag the category, it only shows me 1 category, which is for the total.

kilala_0-1649040694443.png

 


I think it is because i create measure? how do i solve this?

 

 

@kilala , Please find the attached file

 

 

Hi @amitchandak ,

from you sample, category is a column in the data table. but as for my case, "category" is a measure, so it doesnt belong to any table. how do i cater this?

@kilala , Then you have create a table with these category value , say Cat 

 

then create a new measure and use that with the Category of this new table

 

countx(filter(Values(Table[ID]) , [Category] = max(Cat[Category]) ), [ID])

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.