The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Dear experts,
I have the following issue.
I have a slicer with several elements. When 2 specific elements are selected, I want a specific calculation and if they are not, I want another one.
I'm trying:
IF(
SELECTEDVALUE(G_L Entry'[BU]) = "B2B"||
SELECTEDVALUE(G_L Entry'[BU]) = "B2I";
[Revenue] * [ExchRateCurrency];
"" )
Another way that it's not working either:
IF(
OR(
SELECTEDVALUE(G_L Entry'[BU]) = "B2B";
SELECTEDVALUE(G_L Entry'[BU]) = "B2I");
[Revenue] * [ExchRateCurrency];
"" )
Could somebody help, please?
Solved! Go to Solution.
Sorry i was abit to quick there! 🙂
IF(
AND(
FIRSTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2B" ||
FIRSTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2I" ;
LASTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2B" ||
LASTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2I" ) ;
[Revenue] * [ExchRateCurrency];
"" )
While there is more than 1 value in G_L Entry [BU] selectedvalue() will always return blank(). That is why your measure is not working. You need to use FIRSTNONBLANK() and LASTNONBLANK() to find the two values.
IF(
AND(
FIRSTNONBLANK(G_L Entry'[BU]) = "B2B" ||
FIRSTNONBLANK(G_L Entry'[BU]) = "B2I" ;
LASTNONBLANK(G_L Entry'[BU]) = "B2B" ||
LASTNONBLANK(G_L Entry'[BU]) = "B2I" ) ;
[Revenue] * [ExchRateCurrency];
"" )
Br,
J
@MartynRamsden I am getting blanks when those are selected.
@tex628 Sounds logical. Thanks.
I think that I'm missing someting. I am getting the error "Too few arguments were passes to the FIRSTNONBLANK function. The minimum argument count for the function is 2."
Sorry i was abit to quick there! 🙂
IF(
AND(
FIRSTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2B" ||
FIRSTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2I" ;
LASTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2B" ||
LASTNONBLANK(G_L Entry'[BU];G_L Entry'[BU]) = "B2I" ) ;
[Revenue] * [ExchRateCurrency];
"" )
@tex628 Perfect. It works. Thank you so much!
@MartynRamsden Thanks a lot for your help too.
Hi @setis
Both expressions look ok to me. What result are you seeing?
Have you tried IN?
Measure =
IF(
SELECTEDVALUE( G_L Entry'[BU] ) IN { "B2B", "B2I" };
[Revenue] * [ExchRateCurrency];
""
)
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
122 | |
89 | |
75 | |
55 | |
45 |
User | Count |
---|---|
134 | |
120 | |
76 | |
65 | |
64 |