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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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 ))

 

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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