Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Need help on the below scenerio: How to write a DAX?
actual table:
Category | Value |
A | 10 |
B | 20 |
C | 30 |
Out put expecting in the dashboard:
Category | Value | % |
A | A/C | 33% |
B | B/C | 67% |
Total | Measure = (A+B)/C | 100% |
Solved! Go to Solution.
@Naveen29 try this measure
Measure =
VAR _sum =
DIVIDE (
CALCULATE ( SUM ( t3[Value] ), FILTER ( t3, t3[Category] <> "C" ) ),
CALCULATE ( SUM ( t3[Value] ), FILTER ( ALL ( t3 ), t3[Category] = "C" ) )
)
RETURN
_sum
@Naveen29 the solution was based on your original question, now what you are sharing is totally different from than the original requirement.
The question, what decided to use C or Z what is the logic here? Always provide full details. The solution is based on the requirement.
Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Naveen29 @smpa01 measure will work but here is another version of it
% =
DIVIDE (
CALCULATE ( SUM ('Table'[Value] ), KEEPFILTERS ( 'Table'[Category] <> "C" ) ),
CALCULATE ( SUM ('Table'[Value] ),'Table'[Category] = "C" )
)
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks @parry2k - This formula is working fine. However , there is another problem over here. My data is like below. When we have break on the data ,this DAX is not working as expected.
Ex:
Value | |
Group 1\Category Name | |
A | 1 |
B | 3 |
C | 4 |
Group2 \Category Name | |
X | 2 |
Y | 3 |
Z | 6 |
Value | % | |
Group 1 | Total | 100% |
A | A/C | 25% |
B | B/C | 75% |
Group2 | Total | 100% |
X | X/Z | 33% |
Y | Y/Z | 50% |
Global Total | Measure = (A+B+X+Y)/(C+Z) | 90% |
@Naveen29 try this measure
Measure =
VAR _sum =
DIVIDE (
CALCULATE ( SUM ( t3[Value] ), FILTER ( t3, t3[Category] <> "C" ) ),
CALCULATE ( SUM ( t3[Value] ), FILTER ( ALL ( t3 ), t3[Category] = "C" ) )
)
RETURN
_sum