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 have a column in my data table 'Effective Date' with date values like 3/15/2021. I can put this effective date field as a filter, and show only rows within next 12 months with relative date filtering... But it shows data within the current month, which I don't want
My objective: Create a date measure that will allow me to filter by next 12 months, but starting at the first of next month
Example: Today is 3/22/2021. Effective Date: > 4/1/2021 and on
Solved! Go to Solution.
Hi @Anonymous ,
I probably understand what your needs, the following is a case that I did, you can use it as a reference .
(1)I create a table contains ‘Date’column. And calculate table ‘Date’ with the values from ‘Table’[Date]
Date = VALUES('Table'[Date])
(2)Use the table ‘Date’ as a slicer to filter data in another table.
(3)Create a measure to the table ‘Table’
Measure = CALCULATE(SUM('Table'[sale]),
FILTER('Table',[Date]>=EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1 && [Date]<=EDATE(EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1,12)))
EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1 is the first day of the next month of the date you selected
EDATE(EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1,12) is the first day of the next month of the date you selected plus 12 months
Use the above 2 times as the interval standard to filter the data of the table ‘Table’, you will get the result you want.
The effect is as shown:
Best Regards
Ailsa Tao
Hi @Anonymous ,
I probably understand what your needs, the following is a case that I did, you can use it as a reference .
(1)I create a table contains ‘Date’column. And calculate table ‘Date’ with the values from ‘Table’[Date]
Date = VALUES('Table'[Date])
(2)Use the table ‘Date’ as a slicer to filter data in another table.
(3)Create a measure to the table ‘Table’
Measure = CALCULATE(SUM('Table'[sale]),
FILTER('Table',[Date]>=EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1 && [Date]<=EDATE(EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1,12)))
EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1 is the first day of the next month of the date you selected
EDATE(EOMONTH(SELECTEDVALUE('Date'[Date]),0)+1,12) is the first day of the next month of the date you selected plus 12 months
Use the above 2 times as the interval standard to filter the data of the table ‘Table’, you will get the result you want.
The effect is as shown:
Best Regards
Ailsa Tao
Hi, @Anonymous
Please correct me if I wrongly understood.
I think you can use EOMonth function in your measure.
EOMONTH returns the date that in the end of date in the current month context.
So, if you can add 1 day, it will be always the first date of next month.
I hope it helped.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Something like this?
Hi, @Anonymous
Sorry but if it is OK with you, can I see your sample pbix file?
Is it connected to the calendar table or not?
How is it connected?
I am not sure, but I think it depends on how your model looks like.
Please share the sample pbix file, and I can try to come up with the solution.
Thanks.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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 |
---|---|
110 | |
94 | |
80 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |