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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
nijos
Frequent Visitor

DAX measure to fill the gaps

I have created a pbix with three tables:

Actuals, Target and a Date table.

The actuals table has values for all 31 days of March 2024.

The target table only has values for each Friday of March 2024.

I want to create a measure that gives me the Target value to fill the gaps in an additional column of my matrix visual.

So, for each day that is not a Friday, I want to get the value of that weeks Friday value.

I know how to create additional rows for in the Target query via Power Query with List.Dates but I am searching for a DAX calculated measure solution (not a calculated column).

 

PBIDesktop_BaJUnqMMeS.png

PBIDesktop_UlpeQY1uE0.png

I have also created an example PBIX for my query.

https://drive.google.com/file/d/1cQmlY0XXtThw0uIIo5RdVLlUAolRtwIE/view?usp=sharing

Thank you in advance for your help for creating the correct DAX formula.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@nijos Try this:

Measure = 
    VAR __Date = MAX( 'Date'[Date] )
    VAR __Week = WEEKNUM( __Date )
    VAR __Year = YEAR( __Date )
    VAR __Target = MAXX( FILTER( ALL( 'Targets' ), YEAR( [Date] ) = __Year && WEEKNUM( [Date] ) = __Week ), [Target] )
RETURN
    __Target


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
nijos
Frequent Visitor

Thank you @Greg_Deckler , I had the logic in my head all afternoon but could not get it in the measure myself.
Added ReturnType 21 to the WEEKNUM function and now it works perfect!

 

Max Target fixed = 
    VAR __Date = MAX( 'Date'[Date] )
    VAR __Week = WEEKNUM( __Date, 21 )
    VAR __Year = YEAR( __Date )
    VAR __Target = MAXX( FILTER( ALL( 'Targets' ), YEAR( [Date] ) = __Year && WEEKNUM( [Date], 21 ) = __Week ), [Target] )
RETURN
    __Target

nijos_0-1710181821040.png

 

@nijos Perfect. Yeah, I wasn't sure which week number format you were using so I just went with the default.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@nijos Try this:

Measure = 
    VAR __Date = MAX( 'Date'[Date] )
    VAR __Week = WEEKNUM( __Date )
    VAR __Year = YEAR( __Date )
    VAR __Target = MAXX( FILTER( ALL( 'Targets' ), YEAR( [Date] ) = __Year && WEEKNUM( [Date] ) = __Week ), [Target] )
RETURN
    __Target


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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