Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance 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 |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
12 | |
10 | |
6 |