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
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

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.

Top Solution Authors