Forum Discussion
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!
1 Reply
- v-xiaotang
Community Support
Hi CarlsBerg999
Thanks for reaching out to us.
Here is a related article for your reference: https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/select-case-statement
Please check it to see if it helps
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.