Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a date column and I am trying to create a calculated column that contains the dates from current date and shifts back 3 months. So far I noticed it is possible to use DATESBETWEEN or DATESINPERIOD in a CALCULATE function but they can't be used independently which is what I am trying to do. Is there a way I can do this? Here's the dax code I had for my calculated column;
Last3Months = DATESINPERIOD('All Stations'[Date],TODAY(), -3,MONTH)
Here's the error I get;
A table of multiple values was supplied where a single value was expected.
Thanks for your help.
Hi @btalahmbong
DatesBetween and DatesinPeriod both return tables and not a scalar value.
As a result, you cannot use the functions "alone' (except when using DAX as a query language to create new tables) in measures or calculated columns.
But you can use these tables as filter arguments to Calculate yes.
For example, this measure:
SalesLast3Month = Calculate ([Total Sales],DATESINPERIOD('All Stations'[Date],TODAY(), -3,MONTH))
returns the total sales of the last three months.
Measures automatically adapt to filter context and make your calculations dynamic!
For now, I'm creating new measures filtered by last 3 months. I'll keep on playing with it and see if I can find a way to create a column that acts as a 3 monh filter.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
87 | |
65 | |
50 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |