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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JuliaF
Frequent Visitor

How to calculate the difference between the bars and to picture it in a chart?

Hi everyone,

I'm looking for an equivalent visual to display the difference between the bars with Product Number on the x-Axis

JuliaF_0-1642686291154.png

Product A      Product B     Product C

 

Thank you in advance!

 

Best Regards,

Julia

2 ACCEPTED SOLUTIONS
v-angzheng-msft
Community Support
Community Support

Hi, @JuliaF 

You could create a Line and stacked column chart to do this.

To create a measure like this:

Measure = 
var _current=CALCULATE(
    SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[ProductID]=MAX('Table'[ProductID])))
var _pre=CALCULATE(
    SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[ProductID]=MAX('Table'[ProductID])-1))
var _percent=DIVIDE(_current-_pre,_pre)
return _percent

Sample:

vangzhengmsft_0-1642993171175.png

Result:

vangzhengmsft_1-1642993202120.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

View solution in original post

This was the original visual:

JuliaF_0-1663249975759.png

Product A      Product B      Product C

 

I used this measure to calculate the gaps: 

 

difference between the bars=

var _current = calculate(

    AVERAGE(Table[Value]); FILTER(ALL(Table);Table[Index_Product]=MAX(Table[Index_Product])))

var _prev = calculate(

    AVERAGE(Table[Value]); FILTER(ALL(Table);Table[Index_Product]=MAX(Table[Index_Product])-1))

var difference_in_percent = DIVIDE(_current-_prev;_prev)

return difference_in_percent 

 

Then I used this visual JuliaF_2-1663250240768.png to display the gaps calculated with the measure mentioned above. The arrow was imported as a picture-file and grouped with the visual.

JuliaF_1-1663250207539.png

 

I hope this works out for you.

View solution in original post

7 REPLIES 7
MOORE020
Frequent Visitor

Did you build on the example in this post or did you use another means?

This was the original visual:

JuliaF_0-1663249975759.png

Product A      Product B      Product C

 

I used this measure to calculate the gaps: 

 

difference between the bars=

var _current = calculate(

    AVERAGE(Table[Value]); FILTER(ALL(Table);Table[Index_Product]=MAX(Table[Index_Product])))

var _prev = calculate(

    AVERAGE(Table[Value]); FILTER(ALL(Table);Table[Index_Product]=MAX(Table[Index_Product])-1))

var difference_in_percent = DIVIDE(_current-_prev;_prev)

return difference_in_percent 

 

Then I used this visual JuliaF_2-1663250240768.png to display the gaps calculated with the measure mentioned above. The arrow was imported as a picture-file and grouped with the visual.

JuliaF_1-1663250207539.png

 

I hope this works out for you.

Thank you!  I am going to try and implement this today.  I really appreciate your response!

v-angzheng-msft
Community Support
Community Support

Hi, @JuliaF 

You could create a Line and stacked column chart to do this.

To create a measure like this:

Measure = 
var _current=CALCULATE(
    SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[ProductID]=MAX('Table'[ProductID])))
var _pre=CALCULATE(
    SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[ProductID]=MAX('Table'[ProductID])-1))
var _percent=DIVIDE(_current-_pre,_pre)
return _percent

Sample:

vangzhengmsft_0-1642993171175.png

Result:

vangzhengmsft_1-1642993202120.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

Thank u! It helped a lot!

Did you end up getting a visual close to your original post?

Yes! Here is an example 

JuliaF_0-1663222304098.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.