If DAX language (powerPivot)

Aliq2014

New Member
Joined
Sep 10, 2014
Messages
46
Hello I need assistance,

I have the following code:

=IF(AG_TBL[SUPLoc]=AG_TBL[WORKLoc], "Target","Non-target")

Is working fine, however, here is a drawback. If both SupLoc and WorlLoc are blank I'm returning as “target”. Is there a way I can:
A) Identify if both fields are blank to leave them blank
B) Identify if SUPLoc=WORKloc identify them as “target’, else “non-target”

I’m new to powerpivot and i have difficulty translating the code.

Thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I'm looking for nested if statements:

IF SupLoc = WorkLoc then "target"
If SupLoc =" " and WorlLoc = " " then "No Value/Blank"
else "non-target"

Any help is appreciated
 
Upvote 0
Hello Aliq,

I guess you could just do:

Rich (BB code):
=
IF (
    AG_TBL[SUPLoc] <> BLANK ()
        && AG_TBL[SUPLoc] = AG_TBL[WORKLoc],
    "Target",
    "Non-target"
)


 
Upvote 0
Hello Aliq,

I guess you could just do:

Rich (BB code):
=
IF (
    AG_TBL[SUPLoc] <> BLANK ()
        && AG_TBL[SUPLoc] = AG_TBL[WORKLoc],
    "Target",
    "Non-target"
)



Thanks for the response. I should have explained a little more better. I apologize, I basically need to look for 3 possible scenarios:
1) If (SupLoc = WorkLoc) then “Target”
2) Elseif (SupLoc =”” and WorkLoc = “”) then “No Value/Blank”
3) Elseif (SupLoc <> WorkLoc) then “Non-Target”

The code you provided looks ok but I just discovered that there are instances that suploc and workloc aren't equal and I need to set them as non target.
 
Upvote 0
Indeed I didn't handle the case number 2).

Here is what you wanted originally, nested ifs:

Rich (BB code):
=
IF (
    G_TBL[SUPLoc] = BLANK ()
        && AG_TBL[WORKLoc] = BLANK (),
    BLANK (),
    IF (
        G_TBL[SUPLoc] <> BLANK ()
            && AG_TBL[WORKLoc] <> BLANK (),
        "Target",
        "Non-target"
    )
)
 
Upvote 0

Forum statistics

Threads
1,224,145
Messages
6,176,652
Members
452,739
Latest member
SCEducator

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