Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All
Below expression working fine :-
1_REV =
SWITCH(TRUE(),
'GL'[Reporting Code_]>=00001 &&'GL'[Reporting Code_]<=00019,"REV",
BLANK())
Above Expression Return :- Blank AND REV
But
1_ASSET =
SWITCH(TRUE(),
'GL'[Reporting Code]>=50010 &&'GL'[Reporting Code]<=50010,"_ASSET",
'GL'[Reporting Code]>=50023 &&'GL'[Reporting Code]<=50023,"_ASSET",
'GL'[Reporting Code]>=60025 &&'GL'[Reporting Code]<=60025,"_ASSET",
BLANK())
)
Why above expression only return :- Blank ? How to make Blank and _ASSET appear ?
Paul
Solved! Go to Solution.
You have an Extra braket in your formula
Remark: it is better to use IF when using one condition.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Hi @admin11
The account numbers inside the SWITCH don<t make sense
Put the right numbers and it will work
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Thank you very much for spot my mistake.
now i want to make the expression more simple.
Below is working fine :-
_
STOCK =
SWITCH(TRUE(),
'GL'[Reporting Code]>=50010 &&'GL'[Reporting Code]<=50010,"STOCK",
BLANK())
How to convert above expression to Below and make it working :-
_STOCK_ =
SWITCH(TRUE(),
'GL'[Reporting Code]=50010,"STOCK_",
BLANK())
)
You have an Extra braket in your formula
Remark: it is better to use IF when using one condition.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Hi Paul,
What exactly are you trying to do?
When you say you want the measure to return BLANK() and _ASSET I presume you mean under different conditions?
The logic in your measure isn't right. For each line what you are actually saying is check if GL[Reporting Code] is equal to a specific value.
When you write
'GL'[Reporting Code]>=50010 &&'GL'[Reporting Code]<=50010
that's the same as
'GL'[Reporting Code] = 50010
and that's the same for each line. Your upper and lower limits for the tests are the same value so you may as well just test for equality.
1_ASSET =
SWITCH(TRUE(),
'GL'[Reporting Code] = 50010 , "_ASSET",
'GL'[Reporting Code] = 50023 , "_ASSET",
'GL'[Reporting Code] = 60025 , "_ASSET",
BLANK())
)
So looking at that, the string _ASSET will only be returned when 'GL'[Reporting Code] is equal to 50010, 50023 or 60025. Otherwise you'll get BLANK().
regards
Phil
Proud to be a Super User!
Thank you for sharing :-
I just try to create a expression , is working fine :-
_
STOCK =
SWITCH(TRUE(),
'GL'[Reporting Code]>=50010 &&'GL'[Reporting Code]<=50010,"STOCK",
BLANK())
But Below not working :-
_STOCK_ =
SWITCH(TRUE(),
'GL'[Reporting Code]=50010,"STOCK_",
BLANK())
)
Hope you can advise me
My PBI file
Paul
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
101 | |
78 | |
70 | |
63 |
User | Count |
---|---|
141 | |
106 | |
101 | |
85 | |
72 |