Forum Discussion

v_mark's avatar
v_mark
Icon for Helper V rankHelper V
5 years ago
Solved

Convert Calc Col Switch as a measure

I was trying to convert this calculated column into a measure.   Task Bucket = SWITCH( TRUE(), Task[Aged] <= 1, "<24hrs", Task[Aged] <= 3, "<72hrs", Task[Aged] >= 3, ">72hrs")   Any workaroun...
  • selimovd's avatar
    5 years ago

    Hey v_mark ,

     

    a calculated column and a measure are 2 different concepts. You cannot always convert one to another, otherwise there would not be a reason to have both.

    In your case you create a value by each row. If you do that as a measure you lose abilities that a calculated column has, like filtering by that value.

     

    So the real question is what exactly do you want to do?

     

    Otherwise you can easily transform that into a measure, I'm just not sure if you can use it then:

    Task Bucket =
    SWITCH(
        TRUE(),
        MAX(Task[Aged]) <= 1, "<24hrs",
        MAX(Task[Aged]) <= 3, "<72hrs",
        MAX(Task[Aged]) >= 3, ">72hrs"
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi v_mark ,

    First, please make sure the field Task[Aged] will be put on your visual. Then you can create the measure as below to replace the original caculated column [Task Bucket]:

    Measure =
    IF (
        SELECTEDVALUE ( Task[Aged] ) <= 1,
        "<24hrs",
        IF ( SELECTEDVALUE ( Task[Aged] ) <= 3, "<72hrs", ">72hrs" )
    )

    Best Regards