Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Solved! Go to Solution.
Hi @daveinitiv ,
For showing only the last 7 days, you could create a measure for filtering.
Measure = var _max=MAXX(ALL('Table'),[Date])
return IF(_max>=MAX('Table'[Date])&&_max-7<MAX('Table'[Date]),1)
After putting the measure into the visual-level filters and setting up show items when the value is 1, the visual shows the last 7 days only.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Last7day_qty=
VAR datetb= datesinperiod(dimtable[date],max(dimtable[date],-7,day)
VAR last7qty=calculate ([ total quantity],datetb)
VAR selection _fliter=selected value (dimtable [ date]
VAR max_date_last7qty=MAXX (SUMMARIZE (dimtable, dimtable [ date],"maxdate",MAX(dimtable [date])),[total quantity])
return
IF(selection_filter,last7qty,max_date_last7qty)
Feel free to contact:6304729084
Hi @daveinitiv ,
You should try
Quantity last week = CALCULATE([Quantity],FILTER(ALLSELECTED('Table'),[Date]>MAX('Table'[Date])-7&&[Date]<=MAX('Table'[Date])))
Here's an example for this measure.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Stephen,
thanks a lot for your efforts!
But I need something different, actually (sorry I wasn't 100% clear about that, I just noticed):
I want the visual to display to always only the last 7 days in dates. So the daily value for each datapoint, but in the date column only the last 7 days displayed.
I know there is a possibility to achieve a similar thing via the visual filters, but this gives me not enough flexibility (it always calculates last 7 days from today, so when I change the filtercontext to, say, 2 months ago, nothing will be displayed anymore).
It should always work like this: maximum date selected minus 7 on the date value. if no filter selection is made, max date in sales data minus 7 days.
I hope it was kind of clear (sorry, english is not my native language).
Thank you!
BR
David
Hi @daveinitiv ,
For showing only the last 7 days, you could create a measure for filtering.
Measure = var _max=MAXX(ALL('Table'),[Date])
return IF(_max>=MAX('Table'[Date])&&_max-7<MAX('Table'[Date]),1)
After putting the measure into the visual-level filters and setting up show items when the value is 1, the visual shows the last 7 days only.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Stephen,
that's brilliant thanks, I was able to get the solution with a slightly modified formula, which I would never arrived at without your help!
This was the final one that got it solved:
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |