Forum Discussion
Date formula All values to a max date?
- 7 years ago
Hi KarlNixon,
If there is relationship between data table and the fact tabel, once you choose any value in the slicer. Then the fact table will be filterd accrodingly. Then you cannot get the result as you want in the table visual. However for the value in the card, we can use ALL function to ignore the filer. So we can update the measure as below to work on it.
Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(ALL(Table1),Table1[date]<=MAX('CALENDAR'[Date])))For more detaills, please check the pbix as attacched.
Regards,
Frank
Hi KarlNixon,
I made one sample for your referece. Please check the following steps as below.
1. Create a CALENDAR table and create a calculated column in it.
CALENDAR = CALENDARAUTO()
Yearmonth = FORMAT('CALENDAR'[Date],"yyyymmm")
2. Create the measures as below.
Measure = var maxdt = MAX('Table1'[date])
var maxdc = MAX('CALENDAR'[Date])
return
IF(maxdc>=maxdt,1,0)
Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(Table1,Table1[date]<=MAX('CALENDAR'[Date])))
Please filter the table visual by the measure as the picture as below.
For more details, please check the pbix as attached.
Regards,
Frank
- KarlNixon7 years ago
Advocate I
Hi Frank,
It looks like the solution won't work if there is a relationship between the Table1[Date] field and the Calander[Date] field
I'm perplexed as to why?
Karl
- v-frfei-msft7 years ago
Community Support
Hi KarlNixon,
If there is relationship between data table and the fact tabel, once you choose any value in the slicer. Then the fact table will be filterd accrodingly. Then you cannot get the result as you want in the table visual. However for the value in the card, we can use ALL function to ignore the filer. So we can update the measure as below to work on it.
Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(ALL(Table1),Table1[date]<=MAX('CALENDAR'[Date])))For more detaills, please check the pbix as attacched.
Regards,
Frank
- KarlNixon7 years ago
Advocate I
Thanks for your help Frank - all solved!