Forum Discussion
Anonymous
3 years agoNot 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 | |||||
| ID | username | Category | Duration | ||
| 101 | John | Trainer | 60 | ||
| 101 | Tom | Student | 20 | ||
| 101 | Chris | Student | 30 | ||
| 101 | Wilson | Student | 40 | ||
| Expected Output | |||||
| ID | username | Category | Total Trainer Duration | Trainer Name | No of Student |
| 101 | John | Trainer | 60 | John | 3 |
| 101 | Tom | Student | 60 | John | 3 |
| 101 | Chris | Student | 60 | John | 3 |
| 101 | Wilson | Student | 60 | John | 3 |
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"))
2 Replies
- ryan_mayuSuper 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")) - AnonymousNot applicable
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.