Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a table like this: Each user ID has the course name of base and advanced and the duration is the same for each user based on their course name. In fact, for user A, the duration for the base is 36, and for advanced is 27, but it has been written in multiple rows. I want to get an average of duration separately for the base, advanced, and for both together. For instance, the average for the base should be (36,30,20) and the average for advanced is (27,10,15), and for both is (36,27,30,10,20,15).
user ID | Course name | Start finish duration |
A | Base | 36 |
A | Base | 36 |
A | Advanced | 27 |
A | Advanced | 27 |
A | Advanced | 27 |
B | Base | 30 |
B | Base | 30 |
B | Advanced | 10 |
C | Base | 20 |
C | Base | 20 |
C | Base | 20 |
C | Advanced | 15 |
C | Advanced | 15 |
C | Advanced | 15 |
C | Advanced | 15 |
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@CNENFRNLThanks. But is there a way to write a calculated column or measure for that?
If you want a measure then it'll need to create the equivalent of the Table.Distinct(Source) table on the fly.
Avg =
SUMMARIZECOLUMNS(
COURSE[user ID],
COURSE[Course name],
"Avg", AVERAGEX( COURSE, COURSE[Start finish duration] )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |