cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors