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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
itsmeanuj
Helper IV
Helper IV

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. 

 

itsmeanuj_0-1678943573801.png

 

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
1 ACCEPTED SOLUTION

@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

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

15 REPLIES 15
Greg_Deckler
Community Champion
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. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@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?

@itsmeanuj Here you go. PBIX is attached beneath signature.

Greg_Deckler_0-1678965273850.png

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler . This is helpful. But if you see the sample visual i shared,  I am actually looking for differences in IP, FC1, FC2, FC3. 

@itsmeanuj That's great but you didn't provide sample data that included different Versions.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - Actually i have uploaded it on the google drive and share the link in my original post. Here is the link?

 

https://docs.google.com/spreadsheets/d/1UaVzfxFvOK2JuyA6LRLZOAjdbqED1x-U/edit?usp=share_link&ouid=10...

 

@itsmeanuj Updated PBIX attached below signature.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you so much @Greg_Deckler - this worked. Is there a way we can change the colors of the Bars IP, FC1, FC2, and FC3 instead of having just 1 color for them?

@itsmeanuj Yes you could if you create a separate measure for each difference value, which wouldn't be too bad. Then you could set a separate color for each.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - I am confused about how to create a different measures for each Diff value since we have Diff and Previous measures. do you mean to say we have to create these 2 measures for each value? IF yo could just share an example fo 1 value in PBI, then i will be able to replicate it.

 

Thanks,

Anuj

Hi @Greg_Deckler - Any inputs on this would be really helpful.

 

Thanks,
Anuj

@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

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - Thank you! you are a genius. 🙂

@itsmeanuj Missed that link, let me take a look. But, I mean, it's the same exact technique you just have to adjust the category is all. Instead of Month use Version.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.