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.
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.
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.
@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
@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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |