Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
thems5
Regular Visitor

Power BI measure

Hi,
I wish to measure the percentage of the difference between each period to period before.
I am trying to create this report using Power BI for the first time.
When I was using an Excel pivot table, I created this reports by going to "value fields definitions" - "show values as" - "% difference from" - "(the last)".
My question is - I understand that in Power BI I need to write a measure to make this calculation.
Can you help me write this measure(s)?
Please find the attached a screenshot of the file. What I need is to show the table in the file, only with the % of the difference between each year.image.png

 

 
Thanks
Moshe Slonim

 

 

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi Moshe,

 

Just based on your data here, please try the formula below.

Measure =
VAR thisYearTotal =
    SUM ( 'DB_sample'[Sales] )
VAR lastYearTotal =
    CALCULATE (
        SUM ( 'DB_sample'[Sales] ),
        FILTER (
            ALL ( DB_sample[Year] ),
            DB_sample[Year]
                = MIN ( DB_sample[Year] ) - 1
        )
    )
RETURN
    DIVIDE ( thisYearTotal - lastYearTotal, lastYearTotal, 0 )

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

image.png

 

 

Hi @thems5,

 

Can you share your file? Please refer to the snapshot below. Double click the menu "Modeling".

Power_BI_measure

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you.

I cannot find the way to attach a file here so I attached it in my email reply.

Regards

Moshe

Thank you very much Dale.

The good news - it works (partially).

The bad news - 

a. it only works for the total, not for all columns.

b. I coul not find where to change the decimal number to a percentage.

I attach a screen shot.

Can you help?

Thanks

 

 

 

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.