Forum Discussion
Auto Select Previous Day
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
- Anonymous2 years ago
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 TeamIf 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!
3 Replies
- AllanBercesPost ProdigyToday_Column = if('CPDP31_S-Curve'[Date]=TODAY(),"Today",""&'CPDP31_S-Curve'[Date])
- AnonymousNot applicable
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 TeamIf 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! - macmy034Resolver I
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 ;).