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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
Anonymous
Not applicable

DAX help

Hi,

 

Below is the data and have expected output as well. I am trying to write DAX expression to get the 

Total Trainer Duration  ,Trainer Name,No of Student

but couldn't success. any help would be much appreciated.

 

Data     
IDusernameCategoryDuration  
101JohnTrainer60  
101TomStudent20  
101ChrisStudent30  
101WilsonStudent40  
      
      
Expected Output     
IDusernameCategoryTotal Trainer DurationTrainer NameNo of Student
101JohnTrainer60John3
101TomStudent60John3
101ChrisStudent60John3
101WilsonStudent60John3

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

pls try this 

Measure = CALCULATE( sum('Table'[Duration]),FILTER(all('Table'),'Table'[Category]="Trainer"))

Measure 2 = maxx(FILTER(all('Table'),'Table'[Category]="Trainer"),'Table'[username])

Measure 3 = CALCULATE( COUNTROWS('Table'),FILTER(all('Table'),'Table'[Category]="Student"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@Anonymous 

pls try this 

Measure = CALCULATE( sum('Table'[Duration]),FILTER(all('Table'),'Table'[Category]="Trainer"))

Measure 2 = maxx(FILTER(all('Table'),'Table'[Category]="Trainer"),'Table'[username])

Measure 3 = CALCULATE( COUNTROWS('Table'),FILTER(all('Table'),'Table'[Category]="Student"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




dshao
Helper I
Helper I

Is this data in a query in Power BI Desktop already? If so, you do not need a DAX expression, you can just select the fields you want in a table visual.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.