Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi,
I need to display only month values when the date diff between 2 dates is >=90days and display only day values when the date diff is >=4 days, display hour values when the date diff is >= 1 days else display the default date value.
To achieve this , I used a calcuated column named Time level as shown below
Time Level = IF(DATEDIFF(min('Fact'[Production Date-Time]),max('Fact'[Production Date-Time]),DAY)>=90,"M",
(IF(DATEDIFF(min('Fact'[Production Date-Time]),max('Fact'[Production Date-Time]),DAY)>=4,"D",
(IF(DATEDIFF(min('Fact'[Production Date-Time]),max('Fact'[Production Date-Time]),DAY)>=1,"H","E")))
After that i tried using the time level column into another calculated column , when i used the day function, am getting the variant data type error. Please help.
@Anonymous
You may try adding CONVERT.
IF (
'Fact'[Time Level] = "D",
CONVERT ( 'Fact'[Production Date-Time].[Day], STRING ),
CONVERT ( 'Fact'[Production Date-Time], STRING )
)
Hi,
I used the convert function and now my clculated column does not throw the variant data type error but its not displaying the correct value, its diaplaying H by default. Ideally if the timelevel selection is "M" only month value should be displayed, when the time level is "D" it should display days but it is always dispalying "H".
Please find the code below and the screenshot shows the value of timelevel, date diff and the claculated column which is not
showing correctly.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 63 | |
| 62 | |
| 42 | |
| 19 | |
| 16 |
| User | Count |
|---|---|
| 120 | |
| 105 | |
| 38 | |
| 29 | |
| 28 |