In the script provided, the alt() function is used to handle various date formats. The alt() function in Qlik Sense evaluates a list of expressions and returns the first valid expression. If none of the expressions are valid, it returns the last argument provided (in this case, '31/12/2022').
Step-by-step breakdown:
The alt() function checks the Date field for three different formats:
YYYYMMDD
YYYY/MM/DD
DD/MM/YYYY
If none of these formats match the value in the Date field, the default date '31/12/2022' is assigned.
Values in the Date field:
20210131: Matches the first format YYYYMMDD.
2020/01/31: Matches the second format YYYY/MM/DD.
31/01/2019: Matches the third format DD/MM/YYYY.
9999: Does not match any of the formats, so the alt() function returns the default value '31/12/2022'.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit