Forum Discussion

ERICCFG's avatar
ERICCFG
Frequent Visitor
2 years ago

Power BI Formule SWITH

Why this formula does not work, It looks at the condition, if it is true if it will look for the values ​​in the table (day number) compare it smaller to... if yes, zero, if not I take the value in the table (Number of days)

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ERICCFG 

     

    PijushRoy Thank you very much for your prompt reply, please allow me to share some content here.

     

    For your question, here is the method I provided:

     

     

    Create a measure.

     

    NB JOURS = 
    var _status = SELECTEDVALUE('MAINT_WORK_REQUEST_V'[STATUS])
    var _Nombre = SELECTEDVALUE('MAINT_WORK_REQUEST_V'[Nombre de jours])
    RETURN
    SWITCH(
        TRUE(),
        _status = "Urgent" && _Nombre < 1, _Nombre,
        _status = "Pressant" && _Nombre >= 3, _Nombre,
        _status = "Au cours de la semaine" && _Nombre >= 8, _Nombre,
        _status = "Au cours du mois" && _Nombre >= 31, _Nombre,
        0
    )

     

    Here is the result.

     

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.