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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Giskard
New Member

Comparing cummulative from different months by day

Hi guys!

I need to compare the evolution of sales (cummulativeday by day) vs the previous month day by day.

 

Using previousmonth what I get is the total of the previous month.

 

for example:

 

cummulative.PNG

 

Is there a way to do so?

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@Giskard

 

Hi, please try with this little change:

 

Sales Currenth Month =
VAR SelectedDay =
    SELECTEDVALUE ( Table1[Day of Month] )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        FILTER (
            ALL ( Table1 );
            MONTH ( Table1[Date] ) = MONTH ( TODAY () )
                && Table1[Day of Month] <= SelectedDay
        )
    )
Sales Previous Month =
VAR SelectedDay =
    SELECTEDVALUE ( Table1[Day of Month] )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        FILTER (
            ALL ( Table1 );
            MONTH ( Table1[Date] )
                = MONTH ( TODAY () ) - 1
                && Table1[Day of Month] <= SelectedDay
        )
    )

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=CALCULATE([Sales],DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-1),EDATE(MIN('Calendar'[Date]),-1)))

 

There is a relatiosnhip from the Date column of the Data Table to the Date column of the Calendar Table.  In the Pivot/visual, drag the date from the calendar table.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Vvelarde
Community Champion
Community Champion

@Giskard

 

Hi, please try with this little change:

 

Sales Currenth Month =
VAR SelectedDay =
    SELECTEDVALUE ( Table1[Day of Month] )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        FILTER (
            ALL ( Table1 );
            MONTH ( Table1[Date] ) = MONTH ( TODAY () )
                && Table1[Day of Month] <= SelectedDay
        )
    )
Sales Previous Month =
VAR SelectedDay =
    SELECTEDVALUE ( Table1[Day of Month] )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        FILTER (
            ALL ( Table1 );
            MONTH ( Table1[Date] )
                = MONTH ( TODAY () ) - 1
                && Table1[Day of Month] <= SelectedDay
        )
    )

Regards

 

Victor

Lima - Peru




Lima - Peru
v-yulgu-msft
Employee
Employee

Hi @Giskard,

 

Please try measures:

current month sales =
CALCULATE (
    SUM ( 'Table 2'[Cummulative Sales] ),
    FILTER ( 'Table 2', 'Table 2'[Date].[MonthNo] = MONTH ( TODAY () ) )
)

previous month sales =
CALCULATE (
    SUM ( 'Table 2'[Cummulative Sales] ),
    FILTER ( 'Table 2', 'Table 2'[Date].[MonthNo] = MONTH ( TODAY () ) - 1 )
)

1.PNG

 

Best regards,

Yuliana Gu

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

Thanks a lot Yuliana!

Unfortunataly is not working.

 

Im getting the values daily but is not summing them.

 

cummulative2.PNG

Also I believe the TODAY part is the one causing I cant change the filter to other month.

 

What I have is a main fact and a date dimension.

 

I tried this measure:

 

AcumuladoCET = CALCULATE(SUM(DetalleCanal[CET]),filter(DimDate,DimDate[MonthofYear]=MONTH(today())))

 

I think thats what you did. What Im doing wrong?

 

Thanks once again!

Giskard
New Member

Any ideas?

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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