Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys, I have 4 measures each recieving a final alpha grade (A,B,C,D). I want to use an IF statement to essentially select specific outcomes for these measures that would match or equal a select outcome. For reference my measures are as follows:
Customer Name | Customer Sales Rank | Loyalty Measure | Margin Final | cts |
xxx | A | A | A | C |
yyyy | A | A | A | B |
vcv | A | B | D | D |
So for a good customer, they need to have either an A OR B in both sales, loyalty, margin, but a c or d scoring in cts.
As for a potential good customer, they need to have A OR B in margin, but C & D in the rest of the factors.
I have used the following measure but I still get stuck.
IF(SALES RANK = "A" || SALS RANK "B" && MARGIN FINAL = "A"||MARGIN FINAL = B ETC......
I have used the OR operators and && operators but I still sometimes do not get the correct grouping. Any ideas?
@cdawidow , Try like
switch( true(),
[Customer Sales] in {"A","B"} && [Rank Loyalty] in {"A","B"} && [Measure Margin] in {"A","B"} && [Final cts] in {"C","D"} , "Good",
"Bad"
)
or a measure like
maxx(summarize( Table, Table[Customer Name], "Rank" ,
switch( true(),
[Customer Sales] in {"A","B"} && [Rank Loyalty] in {"A","B"} && [Measure Margin] in {"A","B"} && [Final cts] in {"C","D"} , "Good",
"Bad"
)
)
@cdawidow
Try this measure and replace the column names with your measure names:
Measure =
IF(
(
MAX(DATA1[Customer Sales Rank]) IN {"A","B"} &&
MAX(DATA1[Loyalty Measure]) IN {"A","B"} &&
MAX(DATA1[Margin Final]) IN {"A","B"}
) &&
(
MAX(DATA1[cts]) IN {"A","B","C","D"}
),
"GOOD",
IF(
(
MAX(DATA1[Customer Sales Rank]) IN {"A","B"} &&
MAX(DATA1[Loyalty Measure]) IN {"A","B"}
) &&
(
MAX(DATA1[Margin Final]) IN {"A","B","C","D"} &&
MAX(DATA1[cts]) IN {"A","B","C","D"}
),
"POTENTIAL"
)
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @cdawidow
You get the wrong answers because your are not grouping your 'or' statements together with paranthesis.
You can also try to rewrite your measure using the 'IN'-function:
IF([SALES RANK] in ("A","B") && [MARGIN FINAL] in ("A","B") && [LOYALTY] in ("A","B") && [FINALCTS] in ("C","D")
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |