Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
perezco
Advocate III
Advocate III

using fucntions IF, &&(AND), Colum with data and Column without Data

Could someone help to find the problem, 

I am trying to category data result from diferent columns that has data or not. 
lookingto get:

 HD_ACTHD_EXPDC_ACTC_EXPDresult
HD_ACT1xxxHD_ACT
HD_EXPDx1xxHD_EXPD
C_ACT1xxxC_ACT
C_EXPDx1xxC_EXPD
HD_ACT11xxHD
HD_EXPDxx11C
C_ACT1x1xBOTH_ACT
C_EXPDx1x1BOTH_EXPD


But fo some reason the dax is not working.[this is a column calculation]

 

AAA =
VAR ISData_HD_ACT =
    NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) ) --true, exist data
VAR ISBlank_HD_ACT =
    ISBLANK ( data[HD_ACT_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_HD_EXPD =
    NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) ) --true, exist data
VAR ISBlank_HD_EXPD =
    ISBLANK ( data[HD_EXPD_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_C_ACT =
    NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) ) --true, exist data
VAR ISBlank_C_ACT =
    ISBLANK ( data[HD_ACT_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_C_EXPD =
    NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) ) --true, exist data
VAR ISBlank_C_EXPD =
    ISBLANK ( data[HD_EXPD_SKU_Number] ) --true, no data
----------------------------------------------------------------------
RETURN
    IF (
        ISData_HD_ACT && ISBlank_HD_EXPD
            && ISBlank_C_ACT
            && ISBlank_C_EXPD,
        "HD_ACT",
        IF (
            ISData_HD_EXPD && ISBlank_HD_ACT
                && ISBlank_C_ACT
                && ISBlank_C_EXPD,
            "HD_EXPD",
            IF (
                ISData_C_ACT && ISBlank_HD_ACT
                    && ISBlank_HD_EXPD
                    && ISBlank_C_EXPD,
                "C_ACT",
                IF (
                    ISData_C_EXPD && ISBlank_HD_ACT
                        && ISBlank_HD_EXPD
                        && ISBlank_C_ACT,
                    "C_EXPD",
                    IF (
                        ISData_HD_ACT && ISData_HD_EXPD
                            && ISBlank_C_ACT
                            && ISBlank_C_EXPD,
                        "HD",
                        IF (
                            ISData_C_ACT && ISData_C_EXPD
                                && ISBlank_HD_ACT
                                && ISBlank_HD_EXPD,
                            "C",
                            IF (
                                ISData_HD_ACT && ISData_C_ACT
                                    && ISBlank_HD_EXPD
                                    && ISBlank_C_EXPD,
                                "Both ACT",
                                IF (
                                    ISData_HD_EXPD && ISData_C_EXPD
                                        && ISBlank_HD_ACT
                                        && ISBlank_C_ACT,
                                    "Both EXPD",
                                    "failure"
                                )
                            )
                        )
                    )
                )
            )
        )
    )

 

thanks in advance.

2 ACCEPTED SOLUTIONS

I found the error. it has inside of the logic, no symtax issue.

View solution in original post

Icey
Community Support
Community Support

Hi @perezco ,

 

Glad to hear that you have solved the issue.

 

And I find that, it is just caused by this:

 


 

VAR ISData_C_ACT =
NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) )  -----------Change to data[C_ACT_SKU_Number]


VAR ISBlank_C_ACT =
ISBLANK ( data[HD_ACT_SKU_Number] )    -----------Change to data[C_ACT_SKU_Number]


VAR ISData_C_EXPD =
NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) )  -----------Change to data[C_EXPD_SKU_Number]


VAR ISBlank_C_EXPD =
ISBLANK ( data[HD_EXPD_SKU_Number] ) -----------Change to data[C_EXPD_SKU_Number]

 


AAA.PNG

 

Right?

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@perezco , can you explain the logic behind the calculation. As if syntax seems fine, You can use switch

Order of condition is important

AAA =
VAR ISData_HD_ACT =
    NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) ) --true, exist data
VAR ISBlank_HD_ACT =
    ISBLANK ( data[HD_ACT_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_HD_EXPD =
    NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) ) --true, exist data
VAR ISBlank_HD_EXPD =
    ISBLANK ( data[HD_EXPD_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_C_ACT =
    NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) ) --true, exist data
VAR ISBlank_C_ACT =
    ISBLANK ( data[HD_ACT_SKU_Number] ) --true, no data
----------------------------------------------------------------------
VAR ISData_C_EXPD =
    NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) ) --true, exist data
VAR ISBlank_C_EXPD =
    ISBLANK ( data[HD_EXPD_SKU_Number] ) --true, no data
----------------------------------------------------------------------
RETURN
Switch ( true() ,
        ISData_HD_ACT && ISBlank_HD_EXPD
            && ISBlank_C_ACT
            && ISBlank_C_EXPD,
        "HD_ACT",
   ISData_HD_EXPD && ISBlank_HD_ACT
                && ISBlank_C_ACT
                && ISBlank_C_EXPD,
            "HD_EXPD",
     ISData_C_ACT && ISBlank_HD_ACT
                    && ISBlank_HD_EXPD
                    && ISBlank_C_EXPD,
                "C_ACT",
    ISData_C_EXPD && ISBlank_HD_ACT
                        && ISBlank_HD_EXPD
                        && ISBlank_C_ACT,
                    "C_EXPD",
    ISData_HD_ACT && ISData_HD_EXPD
                            && ISBlank_C_ACT
                            && ISBlank_C_EXPD,
                        "HD",
    ISData_C_ACT && ISData_C_EXPD
                                && ISBlank_HD_ACT
                                && ISBlank_HD_EXPD,
                            "C",
    ISData_HD_ACT && ISData_C_ACT
                                    && ISBlank_HD_EXPD
                                    && ISBlank_C_EXPD,
                                "Both ACT",
    ISData_HD_EXPD && ISData_C_EXPD
                                        && ISBlank_HD_ACT
                                        && ISBlank_C_ACT,
                                    "Both EXPD",
     "failure"
                              
    )	

 

I found the error. it has inside of the logic, no symtax issue.

Icey
Community Support
Community Support

Hi @perezco ,

 

Glad to hear that you have solved the issue.

 

And I find that, it is just caused by this:

 


 

VAR ISData_C_ACT =
NOT ( ISBLANK ( data[HD_ACT_SKU_Number] ) )  -----------Change to data[C_ACT_SKU_Number]


VAR ISBlank_C_ACT =
ISBLANK ( data[HD_ACT_SKU_Number] )    -----------Change to data[C_ACT_SKU_Number]


VAR ISData_C_EXPD =
NOT ( ISBLANK ( data[HD_EXPD_SKU_Number] ) )  -----------Change to data[C_EXPD_SKU_Number]


VAR ISBlank_C_EXPD =
ISBLANK ( data[HD_EXPD_SKU_Number] ) -----------Change to data[C_EXPD_SKU_Number]

 


AAA.PNG

 

Right?

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.