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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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