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
madscientist
Frequent Visitor

Challenge with date calcs

Hi - seeking help from this great community!

 

I am trying to prepare a table that has full quarter (QTR) and QTD information at the same time using sample data below:

 

Data:

Product      Date                 Amt

A                01/01/2020      100

A                15/02/2020      200

A                 17/03/2020     150

 

I have active slicers for year and month components to enable the QTD calculation.  So if I were to pick Year = 2020 and month = Feb, here's what I would want to see as output in a table:

 

                         QTD        QTR

Product A         300          450

 

The QTD calc works fine....but I can't seem to figure out how to get a measure that essentially follows the year slicer while at the same time ignores the specific month slicer for filtering yet uses that month to identify the relevant quarter I need. 

 

Thanks for your insights!

1 ACCEPTED SOLUTION

Something like this (there are many ways)

 

QTR=

var currQ = max(Dates[Quarter])

Return Calculate([amt],Dates[Quarter] = currQ)

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

use CALCULATE to break out of the Month filter context but keep the Quarter filter context.

Could you please share an example of what the DAX formula syntax would look like?  Note that I currently do not have a filter for quarter - I only have slicers for Year and Month.

 

My current measures are:

 

QTD = calculate ([amt], datesqtd (dates))

QTR = ????

 

I'm hoping to avoid the need of having a slicer for quarter, as that would seem repetitive once the month is chosen.

Something like this (there are many ways)

 

QTR=

var currQ = max(Dates[Quarter])

Return Calculate([amt],Dates[Quarter] = currQ)

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.

Top Solution Authors