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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Dave1972
Helper I
Helper I

Need support on DAX calculate function with multiple filters

Hi All,

I hope you ncan help me out....I have fact table with the following information and columns.

 

measure = sum of loadloadgroup_codeunloadgroup_codetype of shipment
...blank / empty blank / empty blank / empty 
...111
...222
...333
...444
...1blank / empty8

 

I want to create 3 measures Sum of load for:

  1. P = loadgroupcode = 2 AND unloadgrupcode is not 2 or not blank / empty AND Type of Shipment is not 2 or not blank / empty
  2. E = loadgroupcode = 3 AND Type of Shipment is not blank / empty
  3. Z = loadgroupcode = 1 AND unloadgrupcode is not 1 or not blank / empty AND Type of Shipment is not blank / empty
  4. And in addition one measure P+ E+ Z for the for the sum of load for the combination of P + E + Z.

I started like DAX formula below but is not giving me the correct filter... and cannot find solution in community.

P = CALCULATE([sum of load],

    'Table'[Loadgroup_code] IN { "2" } && 'Table'[Unloadgroup_code] IS <> "2" && 'Table'[Unloadgroup_code] IS <> BLANK && 'Table'[Type of Shipment] IS <> "2" && 'Table'[Type of Shipment] IS <> BLANK
)
 
Pse can someone help to explain how to write the 4 measure in total (3 for each group and 1 total). Thanks in advance, appreciated
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Dave1972 ,

 

In DAX, you could use <>  to replace "is not" , && to replace "and" , || to replace "or",  

So please try the following formula:

P =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "2"
            && ( 'Table'[unloadgroup_code] <> "2"
            || 'Table'[unloadgroup_code] <> "blank / empty" )
            && ( 'Table'[type of shipment] <> "2"
            || 'Table'[type of shipment] <> "blank / empty" )
    )
)
E =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "3"
            && 'Table'[type of shipment] <> "blank / empty"
    )
)
Z =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "1"
            && ( 'Table'[unloadgroup_code] <> "1"
            || 'Table'[unloadgroup_code] <> "blank / empty" )
            && 'Table'[type of shipment] <> "blank / empty"
    )
)
P+E+Z = [P]+[E]+[Z]

The final output is shown below:

P+E+Z.PNG

Best Regards,
Eyelyn Qin
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

Anonymous
Not applicable

Hi @Dave1972 ,

 

It depends on the data type of columns. I have built a data sample for you to easily understand the difference in DAX.

 

1.If data type of these columns are Text, use "" to replace "blank /empty"

Data type is Text = CALCULATE(SUM(Test[Load]),FILTER('Test','Test'[Text]<>""))

2. If data type of these columns are Number, use BLANK() to replace "blank /empty"

Data type is Number = CALCULATE(SUM('Test'[Load]),FILTER('Test','Test'[Number]<>BLANK()))  

The final output is shown below:

Text or Number.PNG

 

Best Regards,
Eyelyn Qin
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
Anonymous
Not applicable

Hi @Dave1972 ,

 

It depends on the data type of columns. I have built a data sample for you to easily understand the difference in DAX.

 

1.If data type of these columns are Text, use "" to replace "blank /empty"

Data type is Text = CALCULATE(SUM(Test[Load]),FILTER('Test','Test'[Text]<>""))

2. If data type of these columns are Number, use BLANK() to replace "blank /empty"

Data type is Number = CALCULATE(SUM('Test'[Load]),FILTER('Test','Test'[Number]<>BLANK()))  

The final output is shown below:

Text or Number.PNG

 

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

Dave1972
Helper I
Helper I

Hi @Eyelyn9, 

 

Thanks so much. It works now fine, however how do I handle instead of text "blank /empty" the fact that this cell is just empty....
Best regards, Dave

 

Anonymous
Not applicable

Hi @Dave1972 ,

 

In DAX, you could use <>  to replace "is not" , && to replace "and" , || to replace "or",  

So please try the following formula:

P =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "2"
            && ( 'Table'[unloadgroup_code] <> "2"
            || 'Table'[unloadgroup_code] <> "blank / empty" )
            && ( 'Table'[type of shipment] <> "2"
            || 'Table'[type of shipment] <> "blank / empty" )
    )
)
E =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "3"
            && 'Table'[type of shipment] <> "blank / empty"
    )
)
Z =
CALCULATE (
    [Sum of Load],
    FILTER (
        'Table',
        'Table'[loadgroup_code] = "1"
            && ( 'Table'[unloadgroup_code] <> "1"
            || 'Table'[unloadgroup_code] <> "blank / empty" )
            && 'Table'[type of shipment] <> "blank / empty"
    )
)
P+E+Z = [P]+[E]+[Z]

The final output is shown below:

P+E+Z.PNG

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.