Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
thealaird
New Member

dax help - calculating totals and subtotals from strings

hi guys,

I have a csv that has several columns containing strings e.g. apple;banana;orange;apple

the strings are outputs from a list of over 200 potential 'fruits' so I cannot name individually within the code

Is it possible to write a dynamic DAX code to extract the total number of fruits per column as well as total number of fruits by fruit

i would like to be able to output a simple bar chart like below

thealaird_0-1704716178737.png

 

 

1 ACCEPTED SOLUTION
sjoerdvn
Super User
Super User

I would recommend to not use DAX for this, but to unpivot the columns when loading the data, e.g. using power query.
https://learn.microsoft.com/en-us/power-query/unpivot-column

 

View solution in original post

1 REPLY 1
sjoerdvn
Super User
Super User

I would recommend to not use DAX for this, but to unpivot the columns when loading the data, e.g. using power query.
https://learn.microsoft.com/en-us/power-query/unpivot-column

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.