cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## DAX

Hi everyone,

Can you help to debug this formula please ?

Thanks a lot,

Benjamin

1 ACCEPTED SOLUTION
Super User

As @parry2k said this is not the best way to have your question answer however I believe I have found your error check the bold part below, you have 2 brackets in the middle of your formula closing it earlier than you need.

`IF(AND(Tableau_owssvr_1[Project complexity]="simple";Tableau_owssvr_1[Adressed request time]<5);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="simple";Tableau_owssvr_1[Adressed request time]>5);"delay";IF(AND(Tableau_owssvr_1[Project complexity]="medium";Tableau_owssvr_1[Adressed request time]<10);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="medium";Tableau_owssvr_1[Adressed request time]>10)) <- this bracket is to much ;"delay";IF(AND(Tableau_owssvr_1[Project complexity]="complex";Tableau_owssvr_1[Adressed request time]<15);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="complex";Tableau_owssvr_1[Adressed request time]>15);"delay"Smiley Wink))))`

On best practices your formula should be written like this:

```Formula =
IF (
AND (
Tableau_owssvr_1[Project complexity] = "simple";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "simple";
);
"delay";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "medium";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "medium";
);
"delay";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "complex";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "complex";
);
"delay";
""
)
)
)
)
)
)
```

don't know what the smiley face in the end represent I placed a "".

But to improve overall legebility and performance you should redo your measure to this:

```ttt =
SWITCH (
TRUE ();
Tableau_owssvr_1[Project complexity] = "simple"
&& Tableau_owssvr_1[Adressed request time] < 5; "on-time";
Tableau_owssvr_1[Project complexity] = "simple"
&& Tableau_owssvr_1[Adressed request time] > 5; "delay";
Tableau_owssvr_1[Project complexity] = "medium"
&& Tableau_owssvr_1[Adressed request time] < 10; "on-time";
Tableau_owssvr_1[Project complexity] = "medium"
&& Tableau_owssvr_1[Adressed request time] > 10; "delay";
Tableau_owssvr_1[Project complexity] = "complex"
&& Tableau_owssvr_1[Adressed request time] < 15; "on-time";
Tableau_owssvr_1[Project complexity] = "complex"
&& Tableau_owssvr_1[Adressed request time] > 15; "delay";
""
)```

As you can see it's much shorte and easier to read, again the "" on the end should be replace by what you have on your smiley face.

Regards,

MFelix

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

3 REPLIES 3
Resident Rockstar

Agree with MFelix.

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

In addition, you could use this dax format tool to check if your dax formulas have syntax error.

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User

As @parry2k said this is not the best way to have your question answer however I believe I have found your error check the bold part below, you have 2 brackets in the middle of your formula closing it earlier than you need.

`IF(AND(Tableau_owssvr_1[Project complexity]="simple";Tableau_owssvr_1[Adressed request time]<5);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="simple";Tableau_owssvr_1[Adressed request time]>5);"delay";IF(AND(Tableau_owssvr_1[Project complexity]="medium";Tableau_owssvr_1[Adressed request time]<10);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="medium";Tableau_owssvr_1[Adressed request time]>10)) <- this bracket is to much ;"delay";IF(AND(Tableau_owssvr_1[Project complexity]="complex";Tableau_owssvr_1[Adressed request time]<15);"on-time";IF(AND(Tableau_owssvr_1[Project complexity]="complex";Tableau_owssvr_1[Adressed request time]>15);"delay"Smiley Wink))))`

On best practices your formula should be written like this:

```Formula =
IF (
AND (
Tableau_owssvr_1[Project complexity] = "simple";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "simple";
);
"delay";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "medium";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "medium";
);
"delay";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "complex";
);
"on-time";
IF (
AND (
Tableau_owssvr_1[Project complexity] = "complex";
);
"delay";
""
)
)
)
)
)
)
```

don't know what the smiley face in the end represent I placed a "".

But to improve overall legebility and performance you should redo your measure to this:

```ttt =
SWITCH (
TRUE ();
Tableau_owssvr_1[Project complexity] = "simple"
&& Tableau_owssvr_1[Adressed request time] < 5; "on-time";
Tableau_owssvr_1[Project complexity] = "simple"
&& Tableau_owssvr_1[Adressed request time] > 5; "delay";
Tableau_owssvr_1[Project complexity] = "medium"
&& Tableau_owssvr_1[Adressed request time] < 10; "on-time";
Tableau_owssvr_1[Project complexity] = "medium"
&& Tableau_owssvr_1[Adressed request time] > 10; "delay";
Tableau_owssvr_1[Project complexity] = "complex"
&& Tableau_owssvr_1[Adressed request time] < 15; "on-time";
Tableau_owssvr_1[Project complexity] = "complex"
&& Tableau_owssvr_1[Adressed request time] > 15; "delay";
""
)```

As you can see it's much shorte and easier to read, again the "" on the end should be replace by what you have on your smiley face.

Regards,

MFelix

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

Super User

@benjaminlvdr what is the issue?

Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤

Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors