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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi Teams
I have facing a problem.
We want if the date is after 16 then it shows the previous month data,
when the data is before 15 then it shows the previous to previous months data.
Hi @Anonymous ,
Please provide some sample data and expected results.
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 @Anonymous ,
Add this as a custom step in your M query:
Table.SelectRows(
previousStep, each
let
Date.Today = Date.From(DateTime.LocalNow())
in
if Date.Day(Date.Today) >= 16
then
Date.Month([yourDate]) = Date.Month(Date.AddMonths(Date.Today, -1))
and Date.Year([yourDate]) = Date.Year(Date.AddMonths(Date.Today, -1))
else
Date.Month([yourDate]) = Date.Month(Date.AddMonths(Date.Today, -2))
and Date.Year([yourDate]) = Date.Year(Date.AddMonths(Date.Today, -2))
)
Pete
Proud to be a Datanaut!
Not Working
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 14 | |
| 11 | |
| 8 | |
| 7 | |
| 6 |