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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AresB
Frequent Visitor

How to get previous quarter data divided by month

Hi everyone,

 

im trying to calculate measure (a distinct count) of the last available quarter of a table minus one.

 

I've reached the result using this formula

 

Total sales_last quarter =
CALCULATE (
    DISTINCTCOUNT ( myMeasure ),
    FILTER (
        ALLSELECTED ( VW_MyTable ),
        VW_MyTable[Quarter] = MAX (VW_MyTable[Quarter] ) - 1
        && YEAR(VW_MyTable[DataSales]) = YEAR(MAX(VW_MyTable[DataSales]))
    )
)
 
and this is the result:
 
AresB_1-1678464873331.png

 

 
 
however if i put the measure together with the month dimension i get the same result (207) over the last quarter

while i'm expeting 48(july) 73(august) and 76 (sept).

The last available date of the table is october2022 (q4 2022)

 

how can i achieve the result splitted by the last 3 months?

 
 
2 REPLIES 2
AresB
Frequent Visitor

Hi, i didnt understand your answer...
let me explain the situation.

Let us suppose that i have data for q4 of 2022 and im in q1 of 2023.
I would like to show only data of 2022 q4 divided by relative months (oct- Nov -Dec)
I need show the data table without any filter applied to the grapf (included date filter)

Thank you very much in advance.

amitchandak
Super User
Super User

@AresB , if you have a date use time intelligence

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))


Qtr Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER('Date'[Date])))

Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),PREVIOUSQUARTER(('Date'[Date])))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.