Forum Discussion

itsmeanuj's avatar
itsmeanuj
Helper IV
3 years ago
Solved

Difference between 2 bars

Hello, 

I need help in creating something similar (kind of waterfall model) visual in PBI. where we want to showcase the difference between 2 bars like this. Data contains more than 1000 rows so I have placed it here as Sample Data. 

 

 

Sample data looks like this

Cost Center Level IDVersionsTime PeriodValue
10004000FC3Jan-20226,226
10004000FC3Feb-20225,685
10004000FC3Mar-2022714,108
10004000FC3Apr-20229,382
10004000FC3May-202211,524
10004000FC3Jun-2022689,278
  • itsmeanuj My guy. You just take the Diff measure and break it into 3 measures, one for each difference value. PBIX is attached below signature.

    IP Diff = 
        VAR __Axis = MAX('Versions'[Version])
        VAR __Result = 
            SWITCH(__Axis,
                "IP Diff",
                        VAR __1 = SUMX(FILTER('Table',[Versions] = "IP"),[Value])
                        VAR __2 = SUMX(FILTER('Table',[Versions] = "FC1"),[Value])
                        VAR __Result = IF(__1 < __2, __2 - __1, __1 - __2)
                    RETURN
                        __Result,
                BLANK()
            )
    RETURN
        __Result
    
    
    
    FC1 Diff = 
        VAR __Axis = MAX('Versions'[Version])
        VAR __Result = 
            SWITCH(__Axis,
                "FC1 Diff",
                        VAR __1 = SUMX(FILTER('Table',[Versions] = "FC1"),[Value])
                        VAR __2 = SUMX(FILTER('Table',[Versions] = "FC2"),[Value])
                        VAR __Result = IF(__1 < __2, __2 - __1, __1 - __2)
                    RETURN
                        __Result,            
                BLANK()
            )
    RETURN
        __Result
    
    
    
    
    
    FC2 Diff = 
        VAR __Axis = MAX('Versions'[Version])
        VAR __Result = 
            SWITCH(__Axis,          
                "FC2 Diff",
                        VAR __1 = SUMX(FILTER('Table',[Versions] = "FC2"),[Value])
                        VAR __2 = SUMX(FILTER('Table',[Versions] = "FC3"),[Value])
                        VAR __Result = IF(__1 < __2, __2 - __1, __1 - __2)
                    RETURN
                        __Result,
                BLANK()
            )
    RETURN
        __Result
    

     

15 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    itsmeanuj If the standard waterfall chart won't work you'll need to check out the App Store for custom visuals that may work or use something like Deneb custom visual. 

    • itsmeanuj's avatar
      itsmeanuj
      Helper IV

      Greg_Deckler - So is it not possible to play around with some measures to show data in this visual format? like the difference between 2 bars?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        itsmeanuj Oh, it might be possible given a disconnected table, a stacked bar chart and a fancy measure but it's not going to be easy. I'll see if I can pull something out of the hat.