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
Anonymous
Not applicable

Substract 2 parts of an amount for a time period to the total amount (3 parts) of the previous month

Hello everyone,

 

Like 90% of the posts, I'm new to Power BI and I need you for the following :

 

I have a total amount (let's call it X) divided into three subcategories (A,B and C) over 10 periods (months from March to December 2018)

 

I need to show the difference between A+B  April (04/2018) with A+B+C (X) March (03/2018)

 

I created a Time Table, but I can't find how to make the calculation.

I tried to create an Index from 0 to 9 for each month and do a 3 lines long DAX formula with IFs.

 

Thank you for your help and sorry for the English

 

Abasse

 

 

 

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

I would appreciate it if you could share some data sample and your desired output so that I could understand your scenario better and help further on it.

Best Regards,

Cherry

 

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

Hello Cherry @v-piga-msft , thanks for your answer.

 

Here's a screenshot of the graph that i have and the relating data.

 

What I want is a column with 0 for the first month and then this calculation : CURRENT MONTH ["V-OP Mois"+ "Provision" + "Réel"]  - PREVIOUS MONTH ["Provision" + "Réel"]

 

 

PowBi.png

 

Hi @Anonymous ,

Based on your logic, please try the measure below.

Measure =
VAR cur_A =
    CALCULATE ( SUM ( 'Table'[A] ) )
VAR cur_B =
    CALCULATE ( SUM ( 'Table'[B] ) )
VAR cur_C =
    CALCULATE ( SUM ( 'Table'[C] ) )
VAR pre_A =
    CALCULATE (
        SUM ( 'Table'[A] ),
        FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
    )
VAR pre_B =
    CALCULATE (
        SUM ( 'Table'[B] ),
        FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
    )
VAR pre_C =
    CALCULATE (
        SUM ( 'Table'[C] ),
        FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
    )
RETURN
    cur_A + cur_B + cur_C - ( pre_A + pre_C )

If you still need help, please share your sample data with table format and your your desired output so that we could copy and have a test on it.

Best  Regards,

Cherry

 

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

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.