Problems with switch( True()

Mightystomp

Board Regular
Joined
Jan 31, 2006
Messages
50
This code return error code "Argument '4' in SWITCH function is required." I cannot see anything wrong with it but I think it mistakes the last entry as another value in stead of the else.

=switch(True()

;[HasoneValue]=1;

rankx(all(Test[Provider]);[Total Rev];;;dense);

;[Hasonevalue]=2;

blank();

;[hasoneValue]=3;

blank();

blank()
)

Can anyone see where I went wrong?

Thank you
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
well it seems you have a couple of duplicate separators.

Try this

Code:
=SWITCH (
    TRUE ();
    [HasoneValue] = 1; RANKX ( ALL ( Test[Provider] ); [Total Rev];;; DENSE );
    [Hasonevalue] = 2; BLANK ();
    [hasoneValue] = 3; BLANK ();
    BLANK ()
)
 
Last edited:
Upvote 0
well it seems you have a couple of duplicate separators.

Try this

Code:
=SWITCH (
    TRUE ();
    [HasoneValue] = 1; RANKX ( ALL ( Test[Provider] ); [Total Rev];;; DENSE );
    [Hasonevalue] = 2; BLANK ();
    [hasoneValue] = 3; BLANK ();
    BLANK ()
)

Thank you. It works perfectly.
 
Upvote 0
Here's a tip. When you are stuck on your measure, copy the entire measure and paste it at DAX Formatter by SQLBI Make sure you select the correct separators for your country (top right hand corner). Then click format. DAX formatter normally will help you identify where you have made an error. Try it with your original formula that didn't work
 
Upvote 0

Forum statistics

Threads
1,225,668
Messages
6,186,334
Members
453,349
Latest member
neam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top