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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Baskar
Resident Rockstar
Resident Rockstar

Dax - Previous Quarter

Hi,

 

Requirement :

                      1. Want to show Present Quarter and Previous Quarter in Same Visual.

Used Formula : 

                   Previous Quarter = CALCULATE   (
                                                                            COUNT('Date Master (2)'[DayOfMonth]),

                                                                             PREVIOUSQUARTER('Date Master (2)'[Date].[Date])

                                                                         )

This Measure working fine for me.

 

1.JPG

 

 Problem is :

                     1. When i have apply filter am not getting the Previous Quarter value.

                     2. Instead of Previous am getting Next Quarter value. Logically that is correct i can understand .

 

 

2.JPG

 

 

But My question is How can i get my previous Quarter value. I know have to do something on DAX. but i am cluless please help me.

 

@Greg_Deckler

@kcantor

@v-haibl-msft

@Sean

@ImkeF

6 REPLIES 6
kcantor
Community Champion
Community Champion

@Baskar

I would recommend creating the measure for current quarter then wrapping it in dateadd by using Calculate using DAX.

PresentQuarter = COUNT(DateMaster[DayOfMonth])

Previous Quarter = CALCULATE([PresentQuarter], DATEADD(DateMaster[DateKey], -1, quarter))

You would need to verify the formula for your present quarter total but the rest should be verbatium for the previous quarter assuming that your calendar table is called DateMaster and your Date Key column is called DateKey.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




v-yulgu-msft
Employee
Employee

Hi @Baskar,

 

From the screenshots above, I found that the quarter column added to slicer is different from that in table visual, why? In slicer, it shows 1,2,3,4 , while in table it shows Qtr1,Qtr2,ect. So, please check whether you put the correct column into slicer as a filter.

2.png

Please add the Quarter column(Qtr1, Qtr2, Qtr3, Qtr4 ) to slicer to see whether this issue persists. Here is the result in my test.

3.PNG

 

If I have something misunderstood, please provide more detailed information, like sample data, all the measures you used and relationships between tables.

 

Thanks,
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.

How to added Quarter in Slicer, I tried to put quarter in slicer from date. but i cant able so only i created new column as quarter number.

 

 

Can u please help how can i create slicer with Quarter fromDate . @v-yulgu-msft

Hi @Baskar,

 

We cannot create a slicer with Quarter from Date column directly. The same to you, I created a calculated column: 

Quarter = 'Date Master'[Date].[Quarter], and put this column into slicer.

4.PNG

 

I saw you also had this column (Quarter: Qtr1, Qtr2, Qtr3,Qtr4) in your table, why don't you drag this column into slicer? 

 

Thanks,
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.

Hi @v-yulgu-msft

 

Thanks for reply,

 

I tried with Qtr1. But that too not helping me.

 

 

Baskar
Resident Rockstar
Resident Rockstar

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.