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.
Hello all,
This is my current table:
I would like to add a column that shows the % change from previous year for each section.
Currently, I have no measures created.
This is my data:
I would upload the BI file but you have to be a SuperUser to do that.
Any help in pointing me in the right direction would be greatly appreciated.
Regards!
Solved! Go to Solution.
Try these measures:
Total Served = SUM ( 'Table'[Total Served] )
Percent Change from PY =
VAR vCY =
MAX ( 'Table'[Year] )
VAR vCYAmount = [Total Served]
VAR vPYAmount =
CALCULATE ( [Total Served], 'Table'[Year] = vCY - 1 )
VAR vResult =
IF (
HASONEVALUE ( 'Table'[Year] ),
DIVIDE ( vCYAmount - vPYAmount, vPYAmount )
)
RETURN
vResult
For future reference, you can copy your data and paste using the Table icon rather than a screenshot.
Proud to be a Super User!
Hey @e175429
Please use below dax formula
YoY % =
VAR CurrentYear = MAX('Sales'[Year])
VAR PreviousYear = CurrentYear - 1
VAR CurrentYearSales =
CALCULATE(
SUM('Sales'[Sales Amount]),
'Sales'[Year] = CurrentYear
)
VAR PreviousYearSales =
CALCULATE(
SUM('Sales'[Sales Amount]),
'Sales'[Year] = PreviousYear
)
RETURN
IF(
NOT ISBLANK(PreviousYearSales),
DIVIDE(CurrentYearSales - PreviousYearSales, PreviousYearSales, 0),
BLANK()
)
Regards
Govind Sapkade ( Data Analyst , Power BI PL 300 Certified , MS Fabric Enthusiast )
Linkdin : www.linkedin.com/in/govind-sapkade-845104225
Youtube : http://www.youtube.com/@govind_dataanalyst
Your solution worked as well. Thank you kindly
Try these measures:
Total Served = SUM ( 'Table'[Total Served] )
Percent Change from PY =
VAR vCY =
MAX ( 'Table'[Year] )
VAR vCYAmount = [Total Served]
VAR vPYAmount =
CALCULATE ( [Total Served], 'Table'[Year] = vCY - 1 )
VAR vResult =
IF (
HASONEVALUE ( 'Table'[Year] ),
DIVIDE ( vCYAmount - vPYAmount, vPYAmount )
)
RETURN
vResult
For future reference, you can copy your data and paste using the Table icon rather than a screenshot.
Proud to be a Super User!
Thank you very much
User | Count |
---|---|
25 | |
10 | |
7 | |
6 | |
6 |
User | Count |
---|---|
30 | |
11 | |
11 | |
9 | |
7 |