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.
Dear community,
I have a table to record dept of customers. Then I wrote a dax to calculate Topn dept such as below:
Dept TOPN =
var top_n = SELECTEDVALUE('TOPCUSTOMER'[TOP], 3)
var table_1 = SUMMARIZECOLUMNS(Customer[Customer ID], "Total Dept", SUM(Customer[Dept]))
return Calculate(SUM(table_1[Total Dept]), TOPN(top_n, table_1, [Total Dept], DESC))
But at the return step, I can't find column [Total Dept] (red tex) of table_1 (created with var keyword). Please explain for me this case
Thank you
Ops, someone help me?
@neonguyen1803 Maybe:
Dept TOPN =
var top_n = SELECTEDVALUE('TOPCUSTOMER'[TOP], 3)
var table_1 = SUMMARIZECOLUMNS(Customer[Customer ID], "Total Dept", SUM(Customer[Dept]))
return Calculate(SUMX(table_1,[Total Dept]), TOPN(top_n, table_1, [Total Dept], DESC))
Hi Greg,
I tried your solution, and can find the column but the results are wrong.
This is the total debt of all customers. The result does no change when I change Topn rank, eg. change to top3 or top 5 still get the result is 14.18bn
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |