Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ERICCFG
Frequent Visitor

Power BI Formule SWITH

ERICCFG_0-1721825720011.png

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 2
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:

 

vnuocmsft_0-1722497555146.png

 

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.

 

vnuocmsft_1-1722497655613.png

 

Regards,

Nono Chen

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

PijushRoy
Super User
Super User

Hi @ERICCFG 

Please paste the DAX here for rewrite it




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.