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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
Can pls assit me on how to auto select max date on my previous day column.
or either how can i change my below calculated column to previous day
Desired output
Thank you
Solved! Go to Solution.
Hi @AllanBerces ,
I created a Date table:
Date = CALENDAR(DATE(2024,3,1),DATE(2024,4,3))
A measure is created to dynamically represent today, or "today" if it is today.
Measure1 = IF(MAX('Date'[Date]) = TODAY(), "Today",MAX('Date'[Date]))
Creates a measure to dynamically represent the day before today, or "Previous_day" if it is the day before today.
Measure2 = IF(DAY(TODAY()) - DAY(MAX('Date'[Date])) = 1, "Previous_day",MAX('Date'[Date]))
The calculated columns cannot be created and the following error is reported: "Expressions that yield variant data-types cannot be used to define calculated columns."
The page effect is shown below:
If you have other questions please feel free to contact me.
The pbix file is attached.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
If you're going to do this and host it in the Service - get utc time and add your timezone to it - once you push it to the service, TODAY() will refer to UTC Today() - not YOUR today.
If your in a timezone ahead of UTC, youll have to wait that many hours before your report realises that Today is not tomorrow ;).
Hi @AllanBerces ,
I created a Date table:
Date = CALENDAR(DATE(2024,3,1),DATE(2024,4,3))
A measure is created to dynamically represent today, or "today" if it is today.
Measure1 = IF(MAX('Date'[Date]) = TODAY(), "Today",MAX('Date'[Date]))
Creates a measure to dynamically represent the day before today, or "Previous_day" if it is the day before today.
Measure2 = IF(DAY(TODAY()) - DAY(MAX('Date'[Date])) = 1, "Previous_day",MAX('Date'[Date]))
The calculated columns cannot be created and the following error is reported: "Expressions that yield variant data-types cannot be used to define calculated columns."
The page effect is shown below:
If you have other questions please feel free to contact me.
The pbix file is attached.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 102 | |
| 68 | |
| 66 | |
| 58 |