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

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

@Thimma 

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

@Thimma 

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
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.