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.
I am doing a line chart visualization. My x-axis is a date field. I want to filter it so that the start date is 30 days ago and the end date is the current date. How would I do this in Power BI?
Solved! Go to Solution.
@Anonymous
In Power BI Desktop, we can't directly fix a range on X-axis in a chart visual. If your data is up to today, you may try Visual Level filter to limit the TOPN dates based on the DateKey.
However, I think a better approach is creating a calculated table which keeps the latest 30 days data so that you just need to populate this 30 days table into your chart.
1. Add a calculated column in your source table for tagging if current rows is within in "latest 30 days"
If in latest 30 days = IF(DATEDIFF(Table[Date],TODAY(),DAY)>30,0,1)
2. Then create a calculated table basedd on this column.
Latest 30 Days Table = FILTER(table,Table[If in latest 30 days]=0)
Regards,
@Anonymous
In Power BI Desktop, we can't directly fix a range on X-axis in a chart visual. If your data is up to today, you may try Visual Level filter to limit the TOPN dates based on the DateKey.
However, I think a better approach is creating a calculated table which keeps the latest 30 days data so that you just need to populate this 30 days table into your chart.
1. Add a calculated column in your source table for tagging if current rows is within in "latest 30 days"
If in latest 30 days = IF(DATEDIFF(Table[Date],TODAY(),DAY)>30,0,1)
2. Then create a calculated table basedd on this column.
Latest 30 Days Table = FILTER(table,Table[If in latest 30 days]=0)
Regards,
You could create a calculated column like this:
DaysAgo = TODAY() - [Date] * 1.
Then just add a visual, page or report filter where DaysAgo is < 31
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |