Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SuperCal99
Helper I
Helper I

Week-to-date Measure for Card Visual

Hi there,

Looking for some DAX help.

I have the following measure to calculate Week-to date figures, which works perfectly fine for a table visual

WTD =
IF (
HASONEVALUE ( 'Date Dim'[Year] ) && HASONEVALUE ( 'Date Dim'[Month]),
CALCULATE (
SUM (Incident[Resolved COUNT] ),
FILTER (
ALL ( 'Date Dim'),
'Date Dim'[Year]= VALUES ( 'Date Dim'[Year] )
&& 'Date Dim'[Month] = VALUES ( 'Date Dim'[Month])
&& 'Date Dim'[Date] <= MAX ( 'Date Dim'[Date] )
)
),
BLANK ()
)
 
 
However, I would also like to show the Week-to-date value in a card/Multi-row card visual, which resets at the start of each week.

My DAX knowledge isnt great so wondering is there a measure i can use?

Thanks in advance for any advice or guidance
2 REPLIES 2
amitchandak
Super User
Super User

@SuperCal99 , with help from these columns in date table

 

new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

Weekday = WEEKDAY([Date],2)
measures

 

WTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[WeekDay]<=max('Date'[WeekDay])-1))
LWTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1 && 'Date'[WeekDay]<=max('Date'[WeekDay])-1 ))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak for the reply and sorry for the late response.

I ended up going with the below query for wtd, however when published to service and refreshes daily, it returns zero but when i refresh in powerbi desktop, it appears correctly. Any reason why this is?


WeekTD - Resolved =
COALESCE(IF (
HASONEVALUE ( CALENDER[Year] ) && HASONEVALUE ( CALENDER[Week Number] ),
CALCULATE (
SUM ( Incident[Resolved COUNT] ),
FILTER (
ALL ( CALENDER ),
'CALENDER'[Year] = VALUES ( CALENDER[Year] )
&& CALENDER[Week Number] = VALUES ( CALENDER[Week Number] )
&& CALENDER[Created DATE] <= MAX (CALENDER[Created DATE] )
)
),
BLANK ()
),0)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.