Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Help needed with switch column and sum

Hi Guys,    I have created the following calculated column in my Data table.    Availability = SWITCH ( TRUE (), 'Individual Status Raw DATA'[Calendar Type] = "Booked To A Project" ...
  • v-jingzhang's avatar
    v-jingzhang
    3 years ago

    Hi Anonymous 

     

    This is because some names have multiple calendar types, which leads to SELECTEDVALAUE returns the blank value. SELECTEDVALUE function returns the value when the context for columnName has been filtered down to one distinct value only. Otherwise returns alternateResult. In my sample file, I added "Calendar Type" column to the table visual, so for every row it only has one calendar type value. In your file, you don't have "Calendar Type" in the table, so it will return the alternate blank value for those rows which have more than one calendar types. Once you add a filter to select only "Booked To A Project", SELECTEDVALUE will return that value correctly.  

     

    If you only want to display "Name", "Total Project Allocation" and "Evaluation" in the table visual, and as [Total Project Allocation] already has a filter for only "Booked To A Project", you can try below measure. It will return the same result as that in your second screenshot. 

    Evaluation = 
    SWITCH(
        TRUE(),
        [Total Project Allocation] < 1, "Partially Available",
        [Total Project Allocation] > 1, "Overbooked",
        "Fully Booked"
    )

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.