Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Switch function causing many rows

Hi all,    I am using the following DAX measure to format the sum of sales & for some reason when I drop the measure in a visual a bunch of lines of data appear, any ideas on why that would happen/...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    Hmm. Does adding a blank check help at all?

     

    Parent Annual Revenue =
    VAR _1 =
        CALCULATE ( SUM ( 'Sales Table'[Parent Annual Sales] ) )
    VAR _2 =
        SWITCH (
            TRUE (),
            ISBLANK ( _1 ), BLANK (),
            VALUE ( _1 ) >= ( 10 ^ 8 ), FORMAT ( _1, "$#,0,,,.## B; ($#,0,,,.## B)" ),
            VALUE ( _1 ) >= ( 10 ^ 5 ), FORMAT ( _1, "$#,0,,.## M; ($#,0,,.## M)" ),
            VALUE ( _1 ) >= 1000, FORMAT ( _1, "$#,0,.## K; ($#,0,.## K)" ),
            VALUE ( _1 ) < 1000, "-"
        )
    RETURN
        _2