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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Ravikjinfo
Frequent Visitor

Display difference between bars in Line and Column Clustered Chart as Line

I am tring to create a Line and Column Clustered Chart as part of it. I have the Variable dates as X-AXIS (such as days in month or sundays in a year, last 13 weeks etc.. as dates). Y-AXIS has SalesAmount. Now as you can see the dates are 01/01, 01/02, 01/06 etc.. I need to get the difference in the bars displayed as line for example value to be displayed on 01/01 need to be zero but value to be displayed on 01/02 should be as below

=(BarValue of 01/02  - BarValueof 01/01)/BarValue of 01/01 * 100  as percentage. I am having really tough time to calculate this as moving percentage change and dispaly it as line. Any help would be greatly appreciated.

Line and Column Clustered Chart.JPG

 

2 ACCEPTED SOLUTIONS
v-jiascu-msft
Employee
Employee

Hi @Ravikjinfo,

 

Try the mesure below please. Please also check out the demo in the attachment.

Measure =
VAR minimumDay =
    CALCULATE ( MIN ( 'Table1'[Date] ), ALL ( 'Table1' ) )
VAR lastday =
    CALCULATE (
        MAX ( 'Table1'[Date] ),
        FILTER ( ALL ( 'Table1' ), 'Table1'[Date] < MIN ( 'Table1'[Date] ) )
    )
VAR lastTotal =
    CALCULATE (
        SUM ( 'Table1'[Value] ),
        FILTER ( ALL ( 'Table1' ), Table1[Date] = lastday )
    )
RETURN
    IF (
        MIN ( 'Table1'[Date] ) = minimumDay,
        0,
        DIVIDE ( SUM ( Table1[Value] ) - lastTotal, lastTotal )
    )

Best Regards,

Dale

Community Support Team _ Dale
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

Thank you, 

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @Ravikjinfo,

 

Try the mesure below please. Please also check out the demo in the attachment.

Measure =
VAR minimumDay =
    CALCULATE ( MIN ( 'Table1'[Date] ), ALL ( 'Table1' ) )
VAR lastday =
    CALCULATE (
        MAX ( 'Table1'[Date] ),
        FILTER ( ALL ( 'Table1' ), 'Table1'[Date] < MIN ( 'Table1'[Date] ) )
    )
VAR lastTotal =
    CALCULATE (
        SUM ( 'Table1'[Value] ),
        FILTER ( ALL ( 'Table1' ), Table1[Date] = lastday )
    )
RETURN
    IF (
        MIN ( 'Table1'[Date] ) = minimumDay,
        0,
        DIVIDE ( SUM ( Table1[Value] ) - lastTotal, lastTotal )
    )

Best Regards,

Dale

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

Thank you, 

Helpful resources

Announcements
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.