The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I need to display No% and Yes%.
I have market and sales count. I need to display No% and Yes%.
No% =( Sales Count/Grand Total ) * 100 - Ex : (122/370)*100 = 33%
Yes% = 100 - No% - Ex : 100-33 = 67%
Can you please help me with the DAX to get the No% and Yes%?
I have to finally visualize the Yes% in a bar chart.
You can create a measure like
No % =
IF (
ISINSCOPE ( 'Table'[Market] ),
VAR CurrentValue =
SUM ( 'Table'[Sales count] )
VAR TotalValue =
CALCULATE ( SUM ( 'Table'[Sales count] ), ALLSELECTED ( 'Table'[Market] ) )
RETURN
DIVIDE ( CurrentValue, TotalValue )
)
and then
Yes % = 1 - [No %]
Format both measures as percentages
Thank you.. this worked!
Another issue - If i have a 'Market' slicer on the report page, and I select a market .. for example - "Central".
In this case, I just want to show the 'Central' data but with the same yes% of 67%. How to achieve that?
To simplify - the calculation % is still based on the complete data which market slicer should not affect but I am able to see just the data for cental and not others.
For that you could replace ALLSELECTED('Table'[Market]) with ALL('Table'[Market])
User | Count |
---|---|
27 | |
10 | |
8 | |
7 | |
5 |
User | Count |
---|---|
33 | |
13 | |
11 | |
9 | |
8 |