Forum Discussion
Calculate an average with date filter
- 6 years ago
Hi Pedro77000 ,
We can create a measure as below.
Measure = VAR SUMA = CALCULATE ( SUM ( 'Table'[value] ), FILTER ( ALL ( 'Table' ), 'Table'[date] <= MAX ( 'date'[Date] ) ) ) VAR COUNTM = CALCULATE ( DISTINCTCOUNT ( 'Table'[YearMOnth] ), FILTER ( ALL ( 'Table' ), 'Table'[date] <= MAX ( 'date'[Date] ) ) ) RETURN DIVIDE ( SUMA, COUNTM )Also you can find the pbix as attached.
- 6 years ago
Hi Pedro77000 ,
To use ALLEXCEPT instead of ALL should work.
FILTER ( ALLEXCEPT ( 'Table','Table'[region] ), 'Table'[date] <= MAX ( 'date'[Date] ) )If it doesn't meet your requirement, Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Hi Pedro77000 ,
To use ALLEXCEPT instead of ALL should work.
FILTER ( ALLEXCEPT ( 'Table','Table'[region] ), 'Table'[date] <= MAX ( 'date'[Date] ) )
If it doesn't meet your requirement, Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Thank you so much Franck ! that works well ! even if the disadvantage of ALLEXCEPT is having to enter the fields of all dimension tables.