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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
krishna_murthy
New Contributor III

how to make 3 columns added in dax with filter

hi Team,

 

Requesting please check below concern and do the needful.

i have a Event_type fileld in that many classification but i need to add 3 columns to caclualte cont of orders 

Order quantity = event_type(OUTWARD_ORDER_CANCEL) + event_type( OUTWARD_ORDER_COMPLETE) + event_type( OUTWARD_ORDER_SHIPMENT_DISPATCH)


is that possible make one dax expression ???? finaly i need all 3 columns should be added and show total orders 


Below DAX i have used but getting wrong count values  , please fix it is possible 

Order quantity =
CALCULATE(
    COUNTROWS(order_items),
    FILTER(
        order_items,
       
        RELATED(outward_orders[event_type]) <> "OUTWARD_ORDER_CANCEL" &&
        RELATED(outward_orders[event_type]) <> "OUTWARD_ORDER_COMPLETE" &&
        RELATED(outward_orders[event_type]) <> "OUTWARD_ORDER_SHIPMENT_DISPATCH "
    ))
       
1 ACCEPTED SOLUTION
MFelix
Esteemed Contributor III

HI @krishna_murthy ,

 

Try the following code:

Order quantity =
CALCULATE(
    COUNTROWS(order_items),
    FILTER(
        order_items,
       
 NOT( outward_orders[event_type] in {"OUTWARD_ORDER_CANCEL", "OUTWARD_ORDER_COMPLETE" , "OUTWARD_ORDER_SHIPMENT_DISPATCH " })
    )
)

 

Since you are using the && (and) syntax the values need to be the same I assume that each of your values have only one value so if you add them in a list you can get those rows, since you want to have the different values you need to use the NOT syntax. Since there is a relationship between both tables theres is no need to do the RELATED option


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Esteemed Contributor III

HI @krishna_murthy ,

 

Try the following code:

Order quantity =
CALCULATE(
    COUNTROWS(order_items),
    FILTER(
        order_items,
       
 NOT( outward_orders[event_type] in {"OUTWARD_ORDER_CANCEL", "OUTWARD_ORDER_COMPLETE" , "OUTWARD_ORDER_SHIPMENT_DISPATCH " })
    )
)

 

Since you are using the && (and) syntax the values need to be the same I assume that each of your values have only one value so if you add them in a list you can get those rows, since you want to have the different values you need to use the NOT syntax. Since there is a relationship between both tables theres is no need to do the RELATED option


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Top Solution Authors
Users online (8,586)