Forum Discussion
powerbirino
9 years agoFrequent Visitor
DAX SAMEPERIODLASTYEAR + Filter?
Currently I'm using this DAX formula on a Card and it's working: CALCULATE(
DISTINCTCOUNT(Sales[DocumentNumber]);
FILTER(Sales; Sales[Field1] = "1" && Sales[Field2] = VALUE(1))
) But, I want t...
- 9 years ago
Please update the formula as below and try again.
Measure = CALCULATE ( DISTINCTCOUNT ( Sales[DocumentNumber] ); FILTER ( ALL ( Sales ); Sales[Field1] = "1" && Sales[Field2] = VALUE ( 1 ) ); SAMEPERIODLASTYEAR ( Dates[Date] ) )Best Regards,
Herbert
powerbirino
9 years agoFrequent Visitor
Trying that gives (Blank), which is incorrect because it should give a digit.
I know it's wrong because filtering by 2014 the result in the "Current year" Card visual (for instance) gives 3000, and the same visual filtering by 2013 gives 800, but, using the "Last year" Card visual and filtering by 2014 with your solution, gives (Blank), when it should give 800.
I have tried other solutions but I can't achieve this dumb thing :/
v-haibl-msft
9 years agoMicrosoft Employee
Please update the formula as below and try again.
Measure =
CALCULATE (
DISTINCTCOUNT ( Sales[DocumentNumber] );
FILTER ( ALL ( Sales ); Sales[Field1] = "1" && Sales[Field2] = VALUE ( 1 ) );
SAMEPERIODLASTYEAR ( Dates[Date] )
)
Best Regards,
Herbert
- powerbirino9 years agoFrequent Visitor
It was that!
Thank you!!