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
Updated: In the example below, I'm trying to visualize racial composition by year. When race slicers are applied, the correct % are shown. However, the % for all Asians in 2014 is incorrect.
How do I create a dynamic percent measure, so that the correct % shows even when no slicers are used?
Dataframe:
Solved! Go to Solution.
@Anonymous
You are going to need to calulate the absolute values from which the % derives (since you have more than one row per year asians and to calculate over totals). So, what is the % of? is it the % of total headcount? If so, you need to calculate the total headcount as a new calculated column in the data table:
total headcount = DIVIDE( table[Headcount], table [percent])
and then calculate the % as a measure to use in the visuals:
% of total headcount =
VAR headcount =
SUM ( Table[ Headcount] )
VAR TotalHC =
SUM ( Table[total headocunt] )
RETURN
DIVIDE ( headcount, TotalHC )
Proud to be a Super User!
Paul on Linkedin.
Hi @Anonymous ,
Here are the steps you can follow:
1. Create measure.
divide =
var _1=CALCULATE(SUM('Table'[Count]),ALLEXCEPT('Table','Table'[Year],'Table'[Race]))
var _2=CALCULATE(SUM('Table'[Headcount]),ALLEXCEPT('Table','Table'[Year],'Table'[Race]))
return
DIVIDE(_1,_2)
2. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
You are going to need to calulate the absolute values from which the % derives (since you have more than one row per year asians and to calculate over totals). So, what is the % of? is it the % of total headcount? If so, you need to calculate the total headcount as a new calculated column in the data table:
total headcount = DIVIDE( table[Headcount], table [percent])
and then calculate the % as a measure to use in the visuals:
% of total headcount =
VAR headcount =
SUM ( Table[ Headcount] )
VAR TotalHC =
SUM ( Table[total headocunt] )
RETURN
DIVIDE ( headcount, TotalHC )
Proud to be a Super User!
Paul on Linkedin.
@Anonymous , Make sure you have a year column, Try a measure like
divide(sum(table[headcount]), calculate(sum(Table[headcount]), filter(allselected(Table), Table[Year] =max(Table[Year]))))
Thanks @amitchandak, I've made the corrections and will tinker with the solution (new user here!)
User | Count |
---|---|
64 | |
59 | |
47 | |
33 | |
32 |
User | Count |
---|---|
84 | |
75 | |
56 | |
50 | |
44 |