Forum Discussion
DAX: sum with two filters
- 10 years ago
Anonymous Here's the Measure I would use :smileyhappy:
West Sales (Qty NOT 2) MEASURE = CALCULATE ( SUM ( factSales[amount] ), FILTER ( factSales, factSales[storeid] = 1 && factSales[quantity] <> 2 ) )However the way you ask the question it seems you want to filter each table separately???
West Sales (Qty NOT 2) MEASURE 2 = CALCULATE ( SUM ( factSales[amount] ), FILTER ( dimStores, dimStores[name] = "West" ), FILTER ( factSales, factSales[quantity] <> 2 ) )Both of these Measures should work :smileyhappy:
Anonymous Here's the Measure I would use :smileyhappy:
West Sales (Qty NOT 2) MEASURE =
CALCULATE (
SUM ( factSales[amount] ),
FILTER ( factSales, factSales[storeid] = 1 && factSales[quantity] <> 2 )
)
However the way you ask the question it seems you want to filter each table separately???
West Sales (Qty NOT 2) MEASURE 2 =
CALCULATE (
SUM ( factSales[amount] ),
FILTER ( dimStores, dimStores[name] = "West" ),
FILTER ( factSales, factSales[quantity] <> 2 )
)
Both of these Measures should work :smileyhappy:
- imy7 years ago
Helper I
Thank you, it worked!!
- Anonymous7 years agoNot applicable
Thanks! This opens up some new capabilities. Works great. Thanks for posting.
- chavanr5 years ago
Resolver I
Hi Sean
Just a quick question on this one, I am doing the same thing to calculate a measure but it is giving me error "dax comparison operations do not support comparing values of type. consider using the value or format functione Integer with values of type text"
The data type for all the columns is "whole number"
Formula :
Revenue Act = CALCULATE(SUM(FactWeighing[Value]),FILTER(DimMainAccount,DimMainAccount[Post Collections Revenue Excl flag] ="0"),FILTER(DimFinancialDimension,DimFinancialDimension[A_BusinessGroup Code] ="2"))Can you please have a look into this one?Many thanks- Ashish_Mathur5 years ago
Super User
Hi,
Do you get the correct result if you remove the "" from your formula?
- chavanr5 years ago
Resolver I
Ashish_Mathur just have another query
Weighing Status Revenue include = IF(FactWeighing[Weighing Status] ="Closed" || FactWeighing[Weighing Status] = "Closed MOL",1,0)In the above formula, the dax measure is not identifying "Closed MOL" & hence not putting it as flag-1, probably because it has space.Any solution?Many thanks!!