Forum Discussion

delithyotho's avatar
delithyotho
Frequent Visitor
4 years ago
Solved

Card Display $0 when rows are blank with logic

Hi Everyone,   I have a series of Card graphs that sums everything and has a measure that will automatically converts them into corresponding abbreviations like 1bn and 1M, though they will be conv...
  • amitchandak's avatar
    4 years ago

    delithyotho , Add COALESCE to the second condition too, and check. Or add +0 at the end

     

    Card graph =
    Var Total1 = CALCULATE(SUM('MasterData'[Sum1])*1000000)
    Var Total2 = CALCULATE(SUM('MasterData'[Sum2])*1000000)
    Var decimal = "0.0"
    RETURN
    SWITCH ( TRUE() ,
    Total2 >= 1000000000 , CONCATENATE("$", FORMAT (Total1/1000000000, decimal & "bn")) ,
    Total2 < 1000000000, CONCATENATE("$", FORMAT (COALESCE(Total1, 0)/1000000, decimal & "M")) ,
    CONCATENATE("$", FORMAT (COALESCE(Total1, 0) , decimal)
    ))