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
shubhrika
Frequent Visitor

How to write a DAX query to display the subcategory along with it's value for a specific category?

Hi All,

 

I want to write a DAX query to show the subcategory along with the Score for a particular category.

For ex- I want to display the sub-category values belonging to animal category. The input is:

Categorysub-categoryScore
AnimalDog1
AnimalCat2
AnimalHorse3
MineralQuartz1
MineralSilica2
Mineralgypsum1
Mineralfeldspar2
Vegetablecarrot3
Vegetabletomato1

 

I want the output as:

 

Dog1
Cat2
Horse3

 

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@shubhrika , Not sure I got it

Try a measure like this with sub category

calculate(sum(Table[Score]) , filter(Table, Table[Category] = "Animal"))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@shubhrika 

 

You want a DAX query or a DAX measure? These are 2 totally different things...

amitchandak
Super User
Super User

@shubhrika , Not sure I got it

Try a measure like this with sub category

calculate(sum(Table[Score]) , filter(Table, Table[Category] = "Animal"))

@amitchandak thanks alot! It worked

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.

Top Solution Authors