Power BI Report Builder - add time based on date values - vb.net

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!

Related

MS-Access conditional format date in tabular forms row by row

I have created a database to store genealogical records. I have created a tabular form to display records which include a date text box, however I am struggling to display the date text boxes with the formatting different on each row. The different formats I require are "dd/mm/yyyy" where a full date is known, "yyyy" where the year only is known, and the text box to be left blank if the date is unknown. The table the form is aligned to has a field to indicate whether the date is a full date, year only, or no date - field values "fd", "yo" and "nd" so easy to test the format required for each row.
I cannot see how this is possible using the Conditional Format option.
I am happy to use VBA but have struggled with this. I am new to Access and new to VBA but have a technical background (coding in C++ and Java) and VBA currently looks alien to me - but willing to get into it.
Any pointers please will be much appreciated.
Always store dates as DateTime as it can be stored as Null for unknown.
Then, have a Boolean field, YearOnly, to mark values where only the year is known; store the year with any date of the year, like 2020-01-01.
Now, use a query like this:
SELECT
ID,
[Date],
YearOnly,
Format([Date],"yyyy" & IIf(Not [YearOnly],"-mm-dd")) AS DisplayDate
FROM
YourTable;
[Solved] Thank you Kostas K and Gustav, I have implemented the query you suggest, which took me a while to figure out, but I have it now working in my tabular form. My problem was I was trying to achieve this using VBA on loading the form. VBA wise I am a complete novice.
Thanks Bob H

QlikView Dynamic Date Comparisons

I’m relatively new to Qlikview and have a dataset that shows metrics by date.
This data spans two years and the requirement is to have a comparison/variance that is dynamic and can handle the date filters on the report.
For example if the user selects 2018 this field should show the current date compared to the previous year date. Similar for Quarters, months, weeks and weekdays.
Ideally it should always show for the previous period. They’ve had this created in Excel but it can’t handle the amount of records and I suggested QlikView as I had created some other Dashboards in it.
I have tried set analysis though I struggle to see how that would fit into one expression.
Any thoughts would be appreciated!
I would say you would need two expressions, one without a set analysis (that would be filtered by your current selection) and one with a set analysis to guarantee that you only get today's value. This would be something like :
Sum($<[Date Field] = {"$(=Date(Today(), 'DD/MM/YYYY'))}>} [Value Field])
Check the date format conversion to see if it matches the date format of your field.

Automatic date in pivot in stored procedure

As I am less aware of Stored Procedure can anyone help me out with automatic date in pivot as I want the user to select start date and end date and I want to display all the selected dates as horizontally. As till now I am using dynamic dates by writing dates in pivot but I want it to display all the dates from the start date to the end date automatically.
Can anyone help me?
As it should display date as 01,02,03,04,05 up to the end date
In SQL Server you cannot. The column names are part of the query. Dynamic is the way to go, but be careful - dynamic results from SPs are difficult to consume. You might want to rethink and go traditional row-based doing the pivot in your front end.

In Access, How to pick a date range instead of typing two date parameter?

In the Access, i tried to run the query that showing the payroll data between two date. Currently, I need to type two date at the input box. However, I want to use date picker to pick two date to generate the same result. Anyone tell me how to do it?

Issues handling with dates in different systems at VBA

I wonder if anyone can give me some guidance concerning dates.
I am working on this form that contains a date in a textbox and spinbutton that adds/subtracts a day from this date.
In my system, the current date format is dd/mm/yyyy. But I noticed that if user has another format, the spin button will not work properly.
My questions
Is there any windows api that gets user`s system date format? What about a windows api that changes this format?
What is the best way to work on a solution for dates (I have been having lots of troubles when it comes to dates, not just in this application)
Any advices regarding dates at different systems will be appreciated.
Thank you all
If you are using macro,
Use "Cdate" to convert values to date. it will convert different date formats into similar date format.
It can be used for comparing two different format dates
For Example.
Function MyDate(rng As String)
MyDate = CDate(rng)
End Function
In excel formula, You can use "Datevalue" formula to convert different date formats to similar date format.
Use the below link to read it more
http://www.extendoffice.com/documents/excel/1143-excel-convert-number-to-date.html