Forum Discussion

MoayadGharaibeh's avatar
MoayadGharaibeh
Regular Visitor
4 years ago
Solved

How to calculate "Difference % From Previous date"

Hi Community,

 

I was using Excel Dashboards and want to move it to PowerBi. One feature in (excel Pivot Chart) i was using frequently and can't find it in PowerBI is (Show Values As > % Difference From.. > Base Field: Date/Base Item: (Previous)):

 

I need the data to be shown in the Dashboard as per the following lines (secondary axis):

 

How to do it in PowerBI, knowing that i'm a beginner.

 

Thanks

  • Hi MoayadGharaibeh 

     

    In Power BI, you can create a measure to get the daily difference %. I create a sample for your reference. 

     

    Additionally, there are quick measures you can use. But I don't find a quick measure that can calculate the expected result directly, so I modify the code of one quick measure to get the above measure. Pbix file is attached at bottom.  

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

5 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi MoayadGharaibeh 

     

    In Power BI, you can create a measure to get the daily difference %. I create a sample for your reference. 

     

    Additionally, there are quick measures you can use. But I don't find a quick measure that can calculate the expected result directly, so I modify the code of one quick measure to get the above measure. Pbix file is attached at bottom.  

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

  • Thank you v-jingzhang 

     

    That helped alot and now its working but:

    if the previous day was Friday, i have no data for Friday, then Saturday's difference are always -100% (Check below 5/7/2022:  

     

     

    in this case i need it to calculate the difference between Sat and Thu, is there an easy way to do so?

     

    and always the 1st selected date are 0%, which used to be blank in excel pivot chart, check below same chart in excel:

     

     

    Thanks again.

    Moayad

    • v-jingzhang's avatar
      v-jingzhang
      Icon for Community Support rankCommunity Support

      Hi MoayadGharaibeh 

       

      You are welcome. You can refer to this blog about how to sort weekday names. By default, it is sorted alphabetically. So the idea is to add a number type "weekday number" column, then sort "weekday name" column by the "weekday number" column. 

       

      Jing

      • MoayadGharaibeh's avatar
        MoayadGharaibeh
        Regular Visitor

        Hi v-jingzhang 

         

        Thank you i figured out how and edited my message. Can you please check my latest edited reply?

        Appreciated.

        Moayad