cancel
Showing results for 
Search instead for 
Did you mean: 
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 IV
Super User IV

@shubhrika , Not sure I got it

Try a measure like this with sub category

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

3 REPLIES 3
daxer
Solution Sage
Solution Sage

@shubhrika 

 

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

amitchandak
Super User IV
Super User IV

@shubhrika , Not sure I got it

Try a measure like this with sub category

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

@amitchandak thanks alot! It worked

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors