Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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/
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 55 | |
| 42 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 113 | |
| 108 | |
| 38 | |
| 35 | |
| 26 |