Forum Discussion
Date Filter
AnonymousDid you create a relationship between your new calculated table and fact table?
A simpler and crude appoach would be to create a calculated column in your date dimension table called Period which will use a switch statement to spit out a period value. A crude vesion below:
Period = SWITCH(TRUE(), TODAY() - 'Date Table'[Date] <= 7, "Last 7 Days", TODAY() - 'Date Table'[Date] <=30, "Last 30 Days", "All period")
9 Replies
- sanimesaPost Prodigy
Can you please post the fomula you are using? A common issue with date dimension with dates in fact table is if dates in fact table is defined as date-time, it may not match. You can try checking that by creating a table and a simple date dimension filter, whether it is filtering the fact table at all in the first place.
- AnonymousNot applicable
This is the formula I tried to use is there an easier way?
DatePeriod =UNION (ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('Date' , DATESBETWEEN('Date'[Date],today()-07+1,today()) ), 'Date'[Date]),"Period","Last 07 Days") ,ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('Date' , DATESBETWEEN('Date'[Date],today()-14+1,today()) ), 'Date'[Date]),"Period","Last 14 Days") ,ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('Date' , DATESBETWEEN('Date'[Date],today()-30+1,today()) ), 'Date'[Date]),"Period","Last 30 Days") ,ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('Date' , DATESBETWEEN('Date'[Date],today()-90+1,today()) ), 'Date'[Date]),"Period","Last 90 Days") ,ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('Date'), 'Date'[Date]),"Period","Overall")- sanimesaPost Prodigy
AnonymousDid you create a relationship between your new calculated table and fact table?
A simpler and crude appoach would be to create a calculated column in your date dimension table called Period which will use a switch statement to spit out a period value. A crude vesion below:
Period = SWITCH(TRUE(), TODAY() - 'Date Table'[Date] <= 7, "Last 7 Days", TODAY() - 'Date Table'[Date] <=30, "Last 30 Days", "All period")
- AnonymousNot applicable
sanimesa Thank you that worked! I will mark as accepted.
- sanimesaPost Prodigy
Anonymous Glad it worked for you! Thanks for accepting it as solution!