jeudi 19 novembre 2020

PowerBI multiple If's doesn't split data

I'm currently looking to make an age slicer on PowerBI but it doesn't work. Could you help me ? Thank you in advance ! my code :

Age Slice.1 = 
    if(
        20<VALUE(CONTRACT_BASIS[Age]),
        "<20",
        if(
            20<=VALUE(CONTRACT_BASIS[Age])<25,
            "20-25",
            if(
                25<=VALUE(CONTRACT_BASIS[Age])<30,
                "25-30",
                if(
                    30<=VALUE(CONTRACT_BASIS[Age])<40,
                    "30-40",
                    if(
                        40<=VALUE(CONTRACT_BASIS[Age])<50,
                        "40-50",
                        if(
                            50<=VALUE(CONTRACT_BASIS[Age]),
                            "50+",
                            "no age displayed"
                            )              
                    )
                )
            )
        )
    )

the message displayed : "DAX comparison operations do not support comparing values of type True/False with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values."

Aucun commentaire:

Enregistrer un commentaire