The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I am putting together some dynamic text and need a Dax that will return the % that the top supplier makes up of total.
In the example below, I would want DAX to return 50%.
Supplier | Amount |
A | 20 |
B | 15 |
C | 15 |
D | 25 |
D | 25 |
Total | 100 |
I do have following measure in my report if that helps:
Actual Amount = ROUND(SUM('Transactions'[Amount]),2)
Solved! Go to Solution.
You can create a measure with below code
Measure =
var total_sum = CALCULATE(SUM(Supplier_data[Amount]),ALL(Supplier_data))
var getting_max = MAXX(SUMMARIZE(ALL(Supplier_data),Supplier_data[Supplier],Supplier_data[Amount],"Max_Value",SUM(Supplier_data[Amount])/total_sum),[Max_Value])
return FORMAT(getting_max,"0%")
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
This was helpful. I had to tweak the formula a little. Here was the final formula:
% of highest Supplier =
var total_supplier = CALCULATE([Actual Amount],'Find Suppliers - Addl Info'[Supplier]<>BLANK())
var getting_max = MAXX(SUMMARIZE(FILTER('Fact Table','Fact Table'[Supplier ID]<>BLANK()),'Find Suppliers - Addl Info'[Supplier],"Max_Value",SUM('Fact Table'[GL Amount])/total_supplier),[Max_Value])
return
FORMAT(getting_max,"0.0%")
Hi @zzakir ,
If i am taking it correctly you just need a highest % of total. You can take a Max of "% of total column" column.
Measure = MAX(Supplier_data[% of Total])
Please let me know if this is the output you looking.
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samarth_18 I have editted my original question to be clearer.
I do not have % column.
You can create a measure with below code
Measure =
var total_sum = CALCULATE(SUM(Supplier_data[Amount]),ALL(Supplier_data))
var getting_max = MAXX(SUMMARIZE(ALL(Supplier_data),Supplier_data[Supplier],Supplier_data[Amount],"Max_Value",SUM(Supplier_data[Amount])/total_sum),[Max_Value])
return FORMAT(getting_max,"0%")
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
This was helpful. I had to tweak the formula a little. Here was the final formula:
% of highest Supplier =
var total_supplier = CALCULATE([Actual Amount],'Find Suppliers - Addl Info'[Supplier]<>BLANK())
var getting_max = MAXX(SUMMARIZE(FILTER('Fact Table','Fact Table'[Supplier ID]<>BLANK()),'Find Suppliers - Addl Info'[Supplier],"Max_Value",SUM('Fact Table'[GL Amount])/total_supplier),[Max_Value])
return
FORMAT(getting_max,"0.0%")
Hi zzakir,
Is this the result you're looking for? It takes the % value of the top 1 supplier based on the [% of total] column.
TESTMEASURE = CALCULATE(SELECTEDVALUE(Test[% of Total]), TOPN(1,ALL(Test), Test[% of Total],DESC))
Best regards,
Tim
Proud to be a Super User!
Hello @timg,
This is close to what I want. Perhaps I should've asked my original question differently:
I have a transaction table below.
Supplier | Amount |
A | 20 |
B | 15 |
C | 15 |
D | 25 |
D | 25 |
Total | 100 |
I do have following measure in my report if that helps:
Actual Amount = ROUND(SUM('Transactions'[Amount]),2)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
18 | |
18 | |
17 | |
15 | |
11 |
User | Count |
---|---|
35 | |
34 | |
19 | |
18 | |
14 |