Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
I have a measure that counts the number of traces for the most recent day and the day before that. The dates are always linear. Meaning, it goes from 2/21/2024 to 2/20/2024 to 2/19/2024, to 2/16/2024 - it skips weekend dates. The measures Total is correct, but the measure filters out and ShipVia that doesn't have a a COUNT for the current day. I've attached pictures, that should make more sense. I attached a picture of what the end goal is. I also included my measures below. Also, attached is the CASE WHEN for the LAG Date
--This is Current Date Traces = VAR CurrentDate = MAX('Traces R5'[Trace Start Dt Alt]) RETURN CALCULATE( COUNT('Traces R5'[Invoice]), FILTER( ALLEXCEPT('Traces R5', 'Traces R5'[Region], 'Traces R5'[ShipVia]), 'Traces R5'[Trace Start Dt Alt] = CurrentDate ))
--This is PreviousDate Previous Day Traces = VAR CurrentDate = MAX('Traces R5'[Trace Start Dt Alt]) VAR PreviousDate = MAX('Traces R5'[LagDate]) RETURN CALCULATE( COUNT('Traces R5'[Invoice]), FILTER( ALLEXCEPT('Traces R5', 'Traces R5'[Region], 'Traces R5'[ShipVia]), 'Traces R5'[Trace Start Dt Alt] = PreviousDate ) )
, CASE WHEN LEFT(DATENAME(DW,CAST(CONVERT(CHAR(10), S.MAINTDATE, 101) AS DATE)), 3) IN ('Mon') THEN DATEADD(DAY, -3, CAST(CONVERT(CHAR(10), S.MAINTDATE, 101) AS DATE)) WHEN LEFT(DATENAME(DW,CAST(CONVERT(CHAR(10), S.MAINTDATE, 101) AS DATE)), 3) IN ('Tue', 'Wed', 'Thu', 'Fri') THEN DATEADD(DAY, -1, CAST(CONVERT(CHAR(10), S.MAINTDATE, 101) AS DATE)) END AS LagDate
@danchdrezzing , If you are looking for Last work day
New columns in date table
Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Date Cont = if([Work Day]=0,maxx(FILTER('Date',[Date]<EARLIER([Date]) && [Work Day]<> EARLIER([Work Day]) ),[Date]),[Date])
Work Date cont Rank = RANKX(ALL('Date'),[Work Date Cont],,ASC,Dense)
Measures
This Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])))
Last work day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])-1))
diff =[This Day] - [Last work day]
You can consider offset with allselected or previous , new Table calc
Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U
🚀 Power BI Update: Visual calculations (preview)🚀
https://powerbi.microsoft.com/en-us/blog/visual-calculations-preview/
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
77 | |
73 | |
71 | |
45 | |
42 |
User | Count |
---|---|
48 | |
47 | |
29 | |
28 | |
28 |