Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Icon for Helper V rankHelper V
4 years ago

Power BI Report Builder - add time based on date values

Hi,

 

I have a problem with my Power BI report. What I'm trying to accomplish is that if today's date falls between predefined dates, it would add 2 hours to the timestamp. If it falls between another set of dates, it would add 3 hours to the timestamp. There will be multiple dates and therefore an if statement is rather inefficient. I think SWITCH might be able to do this, but I'm struggling with the syntax. Does someone how to accomplish this in the Power BI Report builder VB.NET? What I've tried so far is the following:


=Switch(Now()<DateValue("12,31,2022") And Now()>=("6,30,2021")),Format(DateAdd("h",2,Now()), "dd.MM.yyyy hh:mm:ss tt") & " EET")

 

The code above is just for one date, there would need to be multiple date ranges..

 

Thanks for the help!