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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cards with Sum of sales last quarter and last quarter same period

Hi, 

I need a card with Sales this quarter, one with Sales Previous Quarter and one with the previous Quarter same period (e.g. if this quarter started 35 days ago, I want the sales of the previous quarter past 35 days and not beyond.

 This code seems to work, but I want to make sure it does not create any problem.

Firstly I added a column in the calendar table to have for each date the days past after the beginning of the quarter (see picture).

 

This quarter Sales =
CALCULATE(SUM('Dataset'[Sales]),'Date'[Quarter number]= QUARTER(TODAY()), 'Date'[Year]= YEAR(TODAY()))
 
Last Quarter Sales =
var current_date = DATE(YEAR(TODAY()), MONTH(TODAY())-3, DAY(TODAY()))
return
CALCULATE(SUM('Dataset'[Sales]),
                            'Date'[Quarter number]= QUARTER(current_date), 'Date'[Year]=YEAR(current_date))
 
Last Quarter Same Period Sales = 
var current_date = DATE(YEAR(TODAY()), MONTH(TODAY())-3, DAY(TODAY()))
var Days_Past = CALCULATE(SUM('Date'[Days Past (Quarter)]), 'Date'[Date] = TODAY())
return
CALCULATE(SUM('Dataset'[Sales]),
                            'Date'[Quarter number]= QUARTER(current_date),
                            'Date'[Year]=YEAR(current_date),
                            'Date'[Days Past (Quarter)]<= Days_Past
                            )

SimonePalmas45_0-1675833267942.png

 

 

 

SimonePalmas45_1-1675833452667.png

 

 

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.