Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AllanBerces
Post Prodigy
Post Prodigy

Auto Select Previous Day

Hi, 

Can pls assit me on how to auto select max date on my previous day column. 

AllanBerces_0-1711581588675.png

or either how can i change my below calculated column to previous day

AllanBerces_1-1711581827055.png

Desired output

AllanBerces_2-1711582000107.png

Thank you 

1 ACCEPTED SOLUTION
Anonymous
Not 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:

vhuijieymsft_0-1711605273859.png

 

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!

View solution in original post

3 REPLIES 3
macmy034
Resolver I
Resolver 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 ;).

Anonymous
Not 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:

vhuijieymsft_0-1711605273859.png

 

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!

AllanBerces
Post Prodigy
Post Prodigy

Today_Column = if('CPDP31_S-Curve'[Date]=TODAY(),"Today",""&'CPDP31_S-Curve'[Date])

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.