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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
shep123
Helper I
Helper I

Previous Quarter to Date with Quarter Slicer

I am trying to do a quarter over quarter to date calculation. The current quarter to date isn't an issue. However, I am having an issue getting the previous QTD to work as I want. I have a slicer where users select the quarter they want to look at. When they select a previous quarter that is fine because the previousquarter formula is all I need. However, when looking at the current quarter we want to create a more accuracte comparison. If today is that start of the quarter it wouldn't be useful to compare one day to the entire previous quarter. Power BI does this because the entire quarter is selected in the slicer. Instead we would want to compare today to the first day of the previous quarter. Tomorrow we would want to compare the first 2 days of this quarter to first 2 of last.

 

 

Here is some sample data for a scenario.

DateAmount
1/1/20185
1/2/20183
2/3/20182
3/28/20181
4/1/20188
4/5/20186
6/12/20184

 

If today was 6/12/2018 we would want to get the sum of 1/1/2018-3/12/2018 so we could compare with our current quarter.

QtrQTDPrevious QTD
2018Q21810

 

if today was 6/30/2018, then we would want to compare 1/1/2018-3/31/2018 to the current quarter (4/1/2018 -6/30/2018).

QtrQTDPrevious QTD
2018Q21811

 

What is the best way to go about this?

1 ACCEPTED SOLUTION
shep123
Helper I
Helper I

I solved this by making a previous Qtr flag on the query editor on the date table then adding that as an additional filter in my measure.

 

=Table.AddColumn(#"Changed Type1", "Previous Qtr Flag", each if [Date] <= Date.AddMonths(Date.From(DateTime.LocalNow()),-3) then 1 else 0)

View solution in original post

1 REPLY 1
shep123
Helper I
Helper I

I solved this by making a previous Qtr flag on the query editor on the date table then adding that as an additional filter in my measure.

 

=Table.AddColumn(#"Changed Type1", "Previous Qtr Flag", each if [Date] <= Date.AddMonths(Date.From(DateTime.LocalNow()),-3) then 1 else 0)

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors