Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
I have a table with 3 columns: UserName, StartDate, Duration. I want to get the percentiles of Duration for each user on each day. How to write the query?
Solved! Go to Solution.
Hi Chenxu,
For test, I have made a sample table like this:
To get the percentiles of Duration for each user on each day, you can create a calculate column and use DAX formula below:
Percentile =
VAR Duration_Sum =
SWITCH(Table1[UserName],
"A", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "A")),
"B", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "B")),
"C", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "C")))
RETURN
CALCULATE(DIVIDE(MAX(Table1[Duration]), Duration_SUm), FILTER(Table1, Table1[UserName] = EARLIER(Table1[UserName]) && Table1[StartDate] = EARLIER(Table1[StartDate])))
The result is like below:
Sample PBIX here:
https://www.dropbox.com/s/sb5v6zpbq1kjlc5/For%20Chenxu.pbix?dl=0
Regards,
Jimmy Tao
Hi Chenxu,
For test, I have made a sample table like this:
To get the percentiles of Duration for each user on each day, you can create a calculate column and use DAX formula below:
Percentile =
VAR Duration_Sum =
SWITCH(Table1[UserName],
"A", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "A")),
"B", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "B")),
"C", CALCULATE(SUM(Table1[Duration]), FILTER(Table1, Table1[UserName] = "C")))
RETURN
CALCULATE(DIVIDE(MAX(Table1[Duration]), Duration_SUm), FILTER(Table1, Table1[UserName] = EARLIER(Table1[UserName]) && Table1[StartDate] = EARLIER(Table1[StartDate])))
The result is like below:
Sample PBIX here:
https://www.dropbox.com/s/sb5v6zpbq1kjlc5/For%20Chenxu.pbix?dl=0
Regards,
Jimmy Tao
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!