mardi 10 août 2021

Powerbi to return a 'NA' using the IF that is used in a std table

I have a code in a powerbi table that displays all. It basically counts how long a particular task is performed for mgt. It was done by someone else. I am trying to find out how to get the rows to display a 'No Data' or 'NA' if there is no data. I tried several approaches but could not get it to work. Any suggestions? Linda from Wisconsin.

TimeTaken = 
//----CALCULATIONS
VAR DIFF = 'Opened'[Resolved] - 'Opened'[Opened]
VAR NumOfMinutes = DIFF * 24
    * 60
VAR DAYS =
    IF ( DIFF >= 1, INT ( DIFF ), BLANK () )
VAR HOURS =
    INT ( ( DIFF - DAYS ) * 24 )
VAR MINUTES = NumOfMinutes
    - ( DAYS * 24
    * 60 )
    - ( HOURS * 60 )

//---TEXTS
VAR DaysText =
    IF ( DAYS >= 1, FORMAT ( DAYS, "00" ) & "days" )
        //ELSE ("No Data")  >>>>> this not working.. I deleted some
VAR HoursText =
    FORMAT ( HOURS, "00" ) & "hrs"
VAR MinutesText =
    FORMAT ( MINUTES, "00" ) & "mins"

RETURN
    COMBINEVALUES ( " ", DaysText, HoursText, MinutesText )

Aucun commentaire:

Enregistrer un commentaire