Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello Experts,
I have used below logic to find Total YTD values. When I used it in a visual I see no's for entire year. I just want to show the last 7 days of the values in the graph.
When I use relative day option under filter pane, It filters data for last 7 days and calculates and gives the result.
Hi @Akshay123
If you are not getting the total calculated data for the last seven days correctly, it may have something to do with the function you are using.
TOTALYTD is intended to represent an expression calculated for the current year-to-date date.
Therefore, the function will start counting from the beginning of the current year, regardless of the filter criteria you have in the filter pane.
For your question, here is the method I provided:
Here's some dummy data
“Table”
Here I recommend you to modify the code as follows, create a measure:
Measure =
var _lastdate = MAX('Table'[year])
var _startdate = _lastdate - 7
RETURN
CALCULATE(
SUM('Table'[values]),
FILTER(
ALL('Table'),
'Table'[year] >= _startdate && 'Table'[year] <= _lastdate
)
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI @v-nuoc-msft
When I am using date column within the table, above solution it works,
In my report I used a calander table to show the dates, for blank dates it's not showing the values
for blanks it has to show the previous values