The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all
I am trying to calculate ration in table
table is like below
and i want to get result like this
i want to use the value of b for each year as the denominator
in dashboard i use year and month slicer
How would write DAX to achieve the above result?
Thanks
Solved! Go to Solution.
Hi @minseon ,
This is exactly what you need:
Please follow the steps below:
1) Add a new column Denominator as below:
denominator =
CALCULATE(
SUM(DATA[value]),
FILTER(
DATA,
DATA[category] = "b" && DATA[year] = EARLIER(DATA[year])
)
)
2) Then again add a new column as below:
pct = DATA[value]/DATA[denominator]
That is it your issue is now solved, Visualise the table using matrix or normal Table.
Please mark it correct if it has helped.
Hi @minseon ,
This is exactly what you need:
Please follow the steps below:
1) Add a new column Denominator as below:
denominator =
CALCULATE(
SUM(DATA[value]),
FILTER(
DATA,
DATA[category] = "b" && DATA[year] = EARLIER(DATA[year])
)
)
2) Then again add a new column as below:
pct = DATA[value]/DATA[denominator]
That is it your issue is now solved, Visualise the table using matrix or normal Table.
Please mark it correct if it has helped.
it works!!
Thanks RABI!!
User | Count |
---|---|
26 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
30 | |
15 | |
12 | |
12 | |
7 |