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
RLangkemper
Regular Visitor

latest reported value for a given week

Hi all,

 

I have a table, with a given report date and a measured quantity for that date. The table also comes with a weeknumber and year column. Now I want to chart the data exactly like that, each measured value by week by year. So far so good, the issue arises with some weeks having multiple measurements (so two or more report dates in a week, causing for the chart to show a spike with double the quantity. I want the chart to just show the last measurement of each week in such case.

 

I was trying to write a measure to pick up the quantity for a max date within a week, but getting stuck. Anyone have any suggestion?

 

Thanks,

Richard

 

 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @RLangkemper ,

 

Based on your description, you want to pick up the quantity for a max date within a week. You can try to use the DAX below:

test_maxdate_forweeks.PNG

Measure 2 = 
var max_date = CALCULATE(
    LASTNONBLANK(Sheet3[date],1),
    FILTER(ALL(Sheet3),
        COUNTROWS(FILTER(Sheet3,EARLIER(Sheet3[week_num])=Sheet3[week_num]))))
return IF(MAX(Sheet3[date])=max_date,MAX(Sheet3[report_count]))

You can also refer to the .pbix

 

Best Regards,

Liang

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

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @RLangkemper ,

 

Based on your description, you want to pick up the quantity for a max date within a week. You can try to use the DAX below:

test_maxdate_forweeks.PNG

Measure 2 = 
var max_date = CALCULATE(
    LASTNONBLANK(Sheet3[date],1),
    FILTER(ALL(Sheet3),
        COUNTROWS(FILTER(Sheet3,EARLIER(Sheet3[week_num])=Sheet3[week_num]))))
return IF(MAX(Sheet3[date])=max_date,MAX(Sheet3[report_count]))

You can also refer to the .pbix

 

Best Regards,

Liang

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

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.