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
largetony1210
Regular Visitor

Calculate ignoring a filter

Hi,

 

You probably get this a lot but I'm new to PowerBI and DAX and having some issues with a CALCULATE formula.  It looks like this:

 

CALCULATE(COUNT(Data[id]), FILTER(Data, Data[Year] = YEAR([**LastWeekDate]) && Data[Quarter] = (CEILING(MONTH([**LastWeekDate])/3,1)-1) && Data[DayofQuarter] < [**CurrentDayofQtr])))

 

The formula seems to be accounting for the first two filters, but ignoring the third. completely. 

 

Any suggestions?

 

Thanks.

 

5 REPLIES 5
Hardik
Continued Contributor
Continued Contributor

please share the data sample for the same !

Anonymised sample of dataset shown below.

 

I've double checked my measures and they are fine, and have also tested the filters individually, and the problem seems to be "&& Data[DayofQuarter] < [**CurrentDayofQtr]". For some reason, this will not work in the formula. 

 

 

Capture.PNG

@largetony1210,

What is the data of [**LastWeekDate] and [**CurrentDayofQtr]? Could you please post complete columns of your table that can be copied and pasted?

Regards,

Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 @v-yuezhe-msft these are both measures.

 

[**LastWeekDate] provides the date of the last day in the last week of my dataset: 

**LastWeekDate = MAX(DATE(YEAR(TODAY()),1,1),DATE(YEAR(TODAY()),1,1)-WEEKDAY(DATE(YEAR(TODAY()),1,1),1)+([**LastWeek]-1)*7+1)+7

 

[**LastWeek] here is a whole number.

 

[**CurrentDayofQtr] is the day number of the above date in the current quarter:

**CurrentDayofQtr = CALCULATE(MIN(Data[DayofQuarter]), FILTER(Data, Data[Year] = YEAR([**LastWeekDate])), FILTER(Data, Data[Month] = MONTH([**LastWeekDate])), FILTER(Data, Data[DayofMonth] = DAY([**LastWeekDate])))

 

Hope this helps.

@largetony1210,

Could you please post all the columns that you have mentioned with sample data for us test? You can paste the data into Excel and share Excel via OneDrive.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.