cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nannimora
Helper I
Helper I

Comparing data between two different Month

Hallo,

in need help to modify this measure:

 

1. Trend Crediti = 
CALCULATE (
    SUM ( SYS_CREDEB_PARTITAC[ZZ. Residuo]  );
    FILTER (
        ALLEXCEPT( SYS_CREDEB_PARTITAC;SYS_CREDEB_PARTITAC[ZZ. Residuo];SYS_CREDEB_PARTITAC[Codice_Cliente]; SYS_CREDEB_PARTITAC[Codice_Agente_Ven] ); 
            AND(SYS_CREDEB_PARTITAC[Data_Fattura] <= MAX ( 'Time'[Fine Mese] );SYS_CREDEB_PARTITAC[Incassata] = FALSE ()
            )
    )
)
+
CALCULATE (
    SUM ( SYS_CREDEB_PARTITAC[Importo_Incassato]  );
    FILTER (
        ALLEXCEPT(  SYS_CREDEB_PARTITAC;SYS_CREDEB_PARTITAC[Importo_Incassato];SYS_CREDEB_PARTITAC[Codice_Cliente]; SYS_CREDEB_PARTITAC[Codice_Agente_Ven] ); 
            AND(
                AND(SYS_CREDEB_PARTITAC[Data_Pagamento] > MAX ( 'Time'[Fine Mese] );SYS_CREDEB_PARTITAC[Data_Fattura] <= MAX('Time'[Fine Mese])
                ); SYS_CREDEB_PARTITAC[Incassata] = TRUE ()
            )
        
    )
)

 

 

i would like to compare the resoult of this measure between two different month.

for example:

Cliente

Trend Crediti 3 Month AgoTrend Crediti 1 Month AgoPercentage difference
001150.000100.000-33,33%
002130.000140.0007,69%
003120.000120.0000,00%

 

So, i think i have to create two different measure one that give me the sum at the end of the previous month (ex. 10.31.2019), and the second one that gives me the sum at the end of 3 month ago (ex. 07.31.2019) before today.

 

someone could help me?

thank you so much,

 

Regards

 

1 ACCEPTED SOLUTION

@nannimora ,

 

I would suggest you convert Trend Crediti to calculate column or create another calculate column using the same formula, then create a measure like pattern below to achieve the increase rate each month:

Diff =
VAR Current_Month =
    YEAR ( Table[end of the month] )
VAR Current_Month_total =
    CALCULATE (
        SUM ( Table[Trend Crediti] ),
        FILTER ( Table, Table[end of the month] = Current_Month )
    )
VAR Previous_Month = Current_Month - 1
VAR Previous_Month_Total =
    CALCULATE (
        SUM ( Table[Trend Crediti] ),
        FILTER ( Table, Table[end of the month] = Previous_Month )
    )
RETURN
    ( Current_Month_total - Previous_Month_Total ) / Previous_Month_Total

Community Support Team _ Jimmy Tao

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

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

@nannimora ,

 

I'm confused on your requirement. Could you please share some sample data and give expected result?

 

Regards,

Jimmy Tao

hello @v-yuta-msft ,

 

the measure was sugged in this post:

https://community.powerbi.com/t5/Desktop/Sum-Value-at-the-end-of-the-month/m-p/712715#M344009

 

with this measure i have the result at the end of the month.

 1. Trend Crediti end of the month
 €      5.401.350,0031/01/2019
 €      5.993.730,0028/02/2019
 €      6.702.127,0031/03/2019
 €      7.426.816,0030/04/2019
 €      7.648.569,0031/05/2019
 €      7.637.658,0030/06/2019
 €      7.817.646,0031/07/2019
 €      7.506.633,0031/08/2019
 €      7.236.531,0030/09/2019
 €      7.089.035,0031/10/2019
 €      6.960.956,0030/11/2019
 €      6.960.956,0031/12/2019

now I want to calculate the difference by two diffenent month. and I dont know if i have to start from this measure and create anther one o start to zero.

 

the result expected is:

Fine Mese31/01/201928/02/2019Difference
 1. Trend Crediti  €   5.401.350,00 €   5.993.730,0010%

 

i don't know if i am clear.

 

Regards

 

@nannimora ,

 

I would suggest you convert Trend Crediti to calculate column or create another calculate column using the same formula, then create a measure like pattern below to achieve the increase rate each month:

Diff =
VAR Current_Month =
    YEAR ( Table[end of the month] )
VAR Current_Month_total =
    CALCULATE (
        SUM ( Table[Trend Crediti] ),
        FILTER ( Table, Table[end of the month] = Current_Month )
    )
VAR Previous_Month = Current_Month - 1
VAR Previous_Month_Total =
    CALCULATE (
        SUM ( Table[Trend Crediti] ),
        FILTER ( Table, Table[end of the month] = Previous_Month )
    )
RETURN
    ( Current_Month_total - Previous_Month_Total ) / Previous_Month_Total

Community Support Team _ Jimmy Tao

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

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.