Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello,
I need this DAX to look at a column for the previous working day and is the value is greater than 0 than return the value for the previous working day, otherwise return 0.
Daily VOC = IF ( CALCULATE ( ( SUM ( tblKPIData[VOC (RMA)] ) ), tblDates[Date] = IF ( WEEKDAY ( TODAY (), 3 ) < 4, TODAY () - 1, TODAY () - ( 7 + WEEKDAY ( TODAY (), 3 ) ) ) ) > 0, CALCULATE ( ( SUM ( tblKPIData[VOC (RMA)] ) ), tblDates[Date] = IF ( WEEKDAY ( TODAY (), 3 ) < 4, TODAY () - 1, TODAY () - ( 7 + WEEKDAY ( TODAY (), 3 ) ) ) ), 0 )
My problem is that the DAX to filter by previous working day isn't correct. Apprently it is looking at March 11th (ten days in the past) not 1 buisness day in the past.
IF ( WEEKDAY ( TODAY (), 3 ) < 4, TODAY () - 1, TODAY () - ( 7 + WEEKDAY ( TODAY (), 3 ) ) )
How can I fix this to look at the previous working day?
I've used this DAX to create a COLUMN for returning the previous working day, but that does me no good in a CALCUALTE filter becasue it is a COLUMN and not a MEASURE.
PreviousWorkDay = MAXX( FILTER('tblDates','tblDates'[Date] < EARLIER('tblDates'[Date]) && WEEKDAY('tblDates'[Date],3) <5), /*0=Monday, 6=Sunday --> hence < 5 is Monday to Friday*/ 'tblDates'[Date] )
Maybe someone has an alternative solution for me.
Thank you,
- Justair07
Solved! Go to Solution.
@Anonymous Hello, bacically I just wanted the DAX to show previous working day. For example since today is Tuesday 3/26/2019 the returned date should be Monday 3/25/2019. If to day was Monday 3/25/2019 then the returned value should be Friday 3/22/2019. I think I have it now, What do you think? I needed to change the 4 to a 5.
IF ( WEEKDAY ( TODAY (), 3 ) < 5, TODAY () - 1, TODAY () - ( 7 + WEEKDAY ( TODAY (), 3 ) ) )
Hi,
It would be helpful if you provided a sample of your data to demonstrate what you're looking to do.
Thanks,
Ben
@Anonymous Hello, bacically I just wanted the DAX to show previous working day. For example since today is Tuesday 3/26/2019 the returned date should be Monday 3/25/2019. If to day was Monday 3/25/2019 then the returned value should be Friday 3/22/2019. I think I have it now, What do you think? I needed to change the 4 to a 5.
IF ( WEEKDAY ( TODAY (), 3 ) < 5, TODAY () - 1, TODAY () - ( 7 + WEEKDAY ( TODAY (), 3 ) ) )
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |