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
DGTL
Helper I
Helper I

DAX Measures WTD with DayNumber

Good morning,

I am asking you about a DAX measurement.

Indeed, I would like to compare the Y-1 value for the same NumDayWeek from the previous year.

In order to make a WTD

I have a date table

Can you help me ?

 

Capture d’écran 2023-11-03 à 11.09.44.png

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @DGTL 

 

You can try the following methods.

Measure:

Value Y = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())))
Value Y-1 = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())-1))

vzhangti_0-1699435857144.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @DGTL 

 

You can try the following methods.

Measure:

Value Y = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())))
Value Y-1 = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())-1))

vzhangti_0-1699435857144.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jihwan_Kim
Super User
Super User

Hi, 

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1699070009336.png

 

 

Value Y: = 
SUM( Data[Value] )
Value Y-1: =
VAR _lastyear =
    MAX ( Data[Year] ) - 1
VAR _samenumdayweek =
    MAX ( Data[NumDayWeek] )
RETURN
    CALCULATE (
        SUM ( Data[Value] ),
        Data[Year] = _lastyear
            && Data[NumDayWeek] = _samenumdayweek
    )

 


 

    Microsoft MVP




If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.





LinkedIn
Visit my LinkedIn page





Outlook Booking
Schedule a short Teams meeting to discuss your question.




Good morning,

Thank you for your reply,

But I would have to compare day 5 of week 2 of the year 2022

with day 5 of week 2, of the year 2023

 

Day 5 is not necessarily the same day. It's the fifth day of week 2.

You see ?

thanks again 🙂

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.