Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
5 years ago
Solved

How to combine ( AND ) to column Syntax into 1 ?

Hi All

I have working column for filter REV :-

1_REV =
SWITCH(TRUE(),
'GL'[Reporting Code]>=00001 &&'GL'[Reporting Code]<=00019,"REV",
BLANK())

I also have working column for filter EXP :-

1_EXP =
SWITCH(TRUE(),
'GL'[Reporting Code]>=00100 &&'GL'[Reporting Code]<=00375,"EXP",
BLANK())

I like to combine above 2 syntax into 1 , so that when it selected , it will filter both REV and EXP , i try below it does not work :-

1_REVnEXP =
SWITCH(TRUE(),
'GL'[Reporting Code]>=00001 &&'GL'[Reporting Code]<=00019,"REV",
and
'GL'[Reporting Code]>=00100 &&'GL'[Reporting Code]<=00375,"EXP",
BLANK())

Hope some one can advise me where go wrong ?

 

Below link is my PBI file :-

https://www.dropbox.com/s/rseuk87tgeifc41/PBT_V2021_392%20TI_SI_GL%20how%20to%20combine%202%20column%20syntax%20into%201.pbix?dl=0

 

Paul

  • Hi Paul,

    I think this is what you're looking for:

    1_REVnEXP = 
    SWITCH(
        TRUE(),
        'GL'[Reporting Code]>=00001 &&'GL'[Reporting Code]<=00019,"REV",
        'GL'[Reporting Code]>=00100 &&'GL'[Reporting Code]<=00375,"EXP",
        BLANK()
    )

    Since the conditions for REV and EXP are mutually exclusive, the order doesn't matter.

     

    Regards,

    Owen

2 Replies

  • Hi Paul,

    I think this is what you're looking for:

    1_REVnEXP = 
    SWITCH(
        TRUE(),
        'GL'[Reporting Code]>=00001 &&'GL'[Reporting Code]<=00019,"REV",
        'GL'[Reporting Code]>=00100 &&'GL'[Reporting Code]<=00375,"EXP",
        BLANK()
    )

    Since the conditions for REV and EXP are mutually exclusive, the order doesn't matter.

     

    Regards,

    Owen