Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Running difference on line chart

Hi

I am new to power BI and trying to replicate a chart I commonly plot in excel. I have the line chart setup in power BI, but would like to show the running difference between value on different dates (Snapshot attached). 

 

Greatly appreciate your help! 

 

Power BI Chart:

 

Desired Chart

3 Replies

  • Anonymous ,

     

    Change X-axis type to Categorial like below screen shot.

     

    Don't forget to hit Thumbs up and accept this as a solution if you find it helpful! 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Tahreem24  thanks for the reply. The problem is not so much with displaying date format. I want to add the difference bars on alternate axis. Basically trying to visualize a table like this: 

       11/25/201911/29/201912/6/201912/8/201912/9/2019
      Value385736386685384155393050382790
      Running Diff 949-25308895-10260

       

      1. I dont know how to calculate the Running diff in Power BI. 

      2. How do i display this on the chart 

      • Tahreem24's avatar
        Tahreem24
        Super User

        Anonymous ,

         

        Step 1: Create Index column in Query Editor. Go to Query Editor --> Select Add COlumn Menu --> Choose Index Column --> Apply and Close Editor

        Step 2: Create Calculated column like below:

                  Column =
                        Var previous_Record =
                                                 CALCULATE (
                                                    SUM ( 'Table'[Value] ),
                                                    FILTER ( 'Table', 'Table'[Index]= EARLIER ( 'Table'[Index])-1 ))
         
                                         RETURN
                                                'Table'[Value]- previous_Record
         
        Don't forget to hit Thumbs up and accept this as a solution if you find it helpful!