Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have the following formula for a custom column.
It works except when Time Started or Time Injured is null and then my column returns an error
if([Time Started]>[Time Injured]) then [Time Injured]-[Time Started]+1 else [Time Injured]-[Time Started]
I would like to be to have the value be Unknown if possible?
Solved! Go to Solution.
pls try this
if [Time Started] is null or [Time Injured] is null then null else if [Time Started]>[Time Injured] then [Time Injured]-[Time Started]+1 else [Time Injured]-[Time Started]
Proud to be a Super User!
if([Time Started]>[Time Injured]) then [Time Injured]-[Time Started]+1 else [Time Injured]-[Time Started]
How do I add "if time injured is null or time started is null then null" to what I already have?
pls try this
if [Time Started] is null or [Time Injured] is null then null else if [Time Started]>[Time Injured] then [Time Injured]-[Time Started]+1 else [Time Injured]-[Time Started]
Proud to be a Super User!
Here is screen shot of Power Query See my Time of Work Column which has the error?
you can use try...otherwise... to avoid error
Error handling - Power Query | Microsoft Learn
Proud to be a Super User!
Right,
So there is no easy add on to tell Custom Column it to produce "null" if one or both columns are null
The other way is
if time injured is null or time started is null then null
i think "try" is easier.
Proud to be a Super User!
I do not need text until I create the Time to Injury Group Conditional Column
I know that would be best but my report is so big and complicated, its hard to split out just the page and table I need for a sample.
not sure if this is what you want. We can't get text and number in one column
Column = if(ISBLANK('Table (2)'[Time Started]) || isblank('Table (2)'[Time Injured]),999,if('Table (2)'[Time Started]>'Table (2)'[Time Injured],'Table (2)'[Time Injured]-'Table (2)'[Time Started]+1,'Table (2)'[Time Injured]-'Table (2)'[Time Started]))
so i used 999 to replace the unknown
Proud to be a Super User!
could you pls provide some sample data?
Proud to be a Super User!
User | Count |
---|---|
84 | |
80 | |
70 | |
47 | |
43 |
User | Count |
---|---|
108 | |
54 | |
50 | |
40 | |
40 |