Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have searched extensively about this issue and have yet to see the same type of issue resolved.
I must be able to utilize a filter to return the YTD value up until a certain year/week timeframe.
I must calculated the YTD value for each TR Type - AOG, Crtitical, Standard.
Since there are no AOG TR Types handled in the week of Latest (aka week 2025 - 13) the result is returning blank (or zero because I added a +0)
As you can se in my visual the result should be 13. If I change my filter to 2025 - 12, I see the result of 13 for AOG. However, it always shows 0 on a year/week in which no AOG TR Types were handled.
Does anyone have any thoughts on this how to get it to show 13?
Solved! Go to Solution.
Hi @kinga,
Thanks for your patience and the detailed updates!
I now fully understand the issue, the main challenge is that when the selected Year Week (like 2025-13) has no records for a TR Type (e.g., AOG), the YTD measure returns 0, even though there were values in earlier weeks (like 13 in 2025-12).
I’ve rewritten the DAX to better handle this. It now:
Please try this revised measure:
YTD Shipments =
VAR SelectedYearWeek = MAX ( 'Table'[YearWeek] )
VAR LastNonBlankWeek =
CALCULATE (
MAX ( 'Table'[YearWeek] ),
FILTER (
ALL ( 'Table' ),
'Table'[YearWeek] <= SelectedYearWeek &&
'Table'[Shipments] > 0 &&
'Table'[TR_Type] = SELECTEDVALUE ( 'Table'[TR_Type] )
)
)
RETURN
CALCULATE (
SUM ( 'Table'[Shipments] ),
FILTER (
ALL ( 'Table' ),
'Table'[YearWeek] <= LastNonBlankWeek &&
'Table'[TR_Type] = SELECTEDVALUE ( 'Table'[TR_Type] )
)
) + 0
This should now return 13 for AOG even when 2025-13 has no entries.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @kinga,
Thank you for reaching out to the Microsoft fabric community forum. Thank you @lbendlin, for your inputs on this issue. After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.
Please try this measure I have tried with some sample data in my end, it worked fine:
YTD Shipments =
VAR SelectedWeek = MAX( 'Table'[YearWeek] )
VAR LastAvailableWeek =
CALCULATE(
MAX( 'Table'[YearWeek] ),
'Table'[YearWeek] <= SelectedWeek,
ALLEXCEPT( 'Table', 'Table'[TR_Type] )
)
RETURN
CALCULATE(
SUM( 'Table'[Shipments] ),
'Table'[YearWeek] <= LastAvailableWeek
)
I am also including .pbix file in the below for your better understanding, please have a look into it:
I hope this could resolve your issue, if you need any further assistance, feel free to reach out. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Thanks so much for your quick response! I tried to incorporate with no success. I opened the PBIX sample file and see that there is an entry for TR Type AOG on week 2025 - 13, which in my case there is no entries for this week. I think this is where my problem stems from.
Hi @kinga,
I apologize for any inconvenience caused. After reviewing the details you provided, I have outlined the following steps. Please follow the steps below:
Please ensure that there are no active filters (such as slicers, page filters, or report-level filters) that could be hiding AOG entries. Verify that all TR Types are included in the table visual, as some filters might be excluding AOG.
Open the data view in Power BI and manually search for TR Type AOG to confirm its existence for week 2025-13. If there is no AOG data for week 2025-13 in their dataset, the measure should return the last available value (e.g., 13) instead of 0.
Please try this modified DAX measure: (Table name should be “Table”)
YTD Shipments =
VAR SelectedWeek = MAX( 'Table'[YearWeek] )
VAR LastAvailableWeek =
CALCULATE(
MAX( 'Table'[YearWeek] ),
'Table'[YearWeek] <= SelectedWeek,
'Table'[Shipments] > 0, -- Ensure only weeks with shipments are considered
ALLEXCEPT( 'Table', 'Table'[TR_Type] )
)
RETURN
CALCULATE(
SUM( 'Table'[Shipments] ),
'Table'[YearWeek] <= LastAvailableWeek,
'Table'[TR_Type] = SELECTEDVALUE('Table'[TR_Type]) -- Keep TR Type context
) + 0 -- Ensure it does not return blank
If possible, please copy and paste the data table they are working with to confirm if AOG is missing.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @kinga,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @kinga,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hello, apologies for the delay. I haven't had success yet with the new calculation. It seems to only pull the current week vs YTD.
Hi @kinga,
Thanks for your patience and the detailed updates!
I now fully understand the issue, the main challenge is that when the selected Year Week (like 2025-13) has no records for a TR Type (e.g., AOG), the YTD measure returns 0, even though there were values in earlier weeks (like 13 in 2025-12).
I’ve rewritten the DAX to better handle this. It now:
Please try this revised measure:
YTD Shipments =
VAR SelectedYearWeek = MAX ( 'Table'[YearWeek] )
VAR LastNonBlankWeek =
CALCULATE (
MAX ( 'Table'[YearWeek] ),
FILTER (
ALL ( 'Table' ),
'Table'[YearWeek] <= SelectedYearWeek &&
'Table'[Shipments] > 0 &&
'Table'[TR_Type] = SELECTEDVALUE ( 'Table'[TR_Type] )
)
)
RETURN
CALCULATE (
SUM ( 'Table'[Shipments] ),
FILTER (
ALL ( 'Table' ),
'Table'[YearWeek] <= LastNonBlankWeek &&
'Table'[TR_Type] = SELECTEDVALUE ( 'Table'[TR_Type] )
)
) + 0
This should now return 13 for AOG even when 2025-13 has no entries.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @kinga,
We are following up once again regarding your query. Could you please confirm if the issue has been resolved through the provided solution.
If the issue has been resolved, we kindly request you to share the resolution or key insights here to help others in the community. If we don’t hear back, we’ll go ahead and close this thread.
Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.
Thank you for your understanding and participation.
Hi @kinga,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 27 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |