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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nic88
Frequent Visitor

Looking up a month and year from a week and year

Hi, I'm stuck on an issue where I have two tables, my dimdate table and another table (lifematics) which is missing a month column but contains a column for week number and a column for year. I'm trying to lookup the StartofWeek Date in my dimdate table by using the week number and year. My dimdate table also contains a week number and year column. 

 

I tried to create a column with:

Date = LOOKUPVALUE(DimDate[Start of Week],DimDate[Week of Year],lifematics[weekNumber],DimDate[Fiscal Year],lifematics[year])
But got the error shown of multiple values supplied.

 

This is the lifematics table where I'm trying to add the date for StartofWeek from dimdate table.

nic88_0-1673630995930.png

 

Here is the dimdate table showing the columns I am looking up (red) and the one I am trying to return (blue)

nic88_1-1673631258758.png

 

I have been stuck on this for a few hours and would appreciate any help. Thank you.

 

 

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @nic88 ,

Is there any data which is from year 2022 in the table 'DimDate'? As checked the screenshot for the lifematics table, it seems that the data is for the year 2022. If there is some data in the table 'DimDate', both the formula which suggested by @Greg_Deckler  and the below one can return the expected result...

Date =
CALCULATE (
    MAX ( DimDate[Start of Week] ),
    FILTER (
        DimDate,
        DimDate[Fiscal Year] = lifematics[year]
            && DimDate[Week of Year] = lifematics[weekNumber]
    )
)

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

@nic88 Try:

Date = MAXX(FILTER('DimeDate','DimDate'[Week of Year] = [weekNumber] && 'DimDate'[Fiscal Year] = [year]),[Start of Week])

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , thank you for your response. I tried the code you provided but the column seems to be blank.

 

It doesn't give me an error but the column doesn't have any values...


 

nic88_1-1673634173627.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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