Forum Discussion
DateDiff with Selected Date Value
- Anonymous3 years ago
Hi Gutierrez ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a measure as below to judge if the data is in the period
Flag = VAR _maxdate = MAX ( 'Calendar'[Date] ) VAR _seltenure = SELECTEDVALUE ( 'Tenure'[Tenure] ) VAR _selagent = SELECTEDVALUE ( 'Sales'[AGENT NAME] ) VAR _pdate = CALCULATE ( MAX ( 'Roster'[PRODUCTION DATE] ), FILTER ( 'Roster', 'Roster'[AGENT NAME] = _selagent ) ) RETURN IF ( _seltenure = ">= 60 Days" && DATEDIFF ( _pdate, _maxdate, DAY ) >= 60, 1, IF ( _seltenure = "< 60 Days" && DATEDIFF ( _pdate, _maxdate, DAY ) < 60, 1, 0 ) )2. Create a table visual as below screenshot and apply a visal-level filter on it with the condition (Flag is 1)
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi Gutierrez ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a measure as below to judge if the data is in the period
Flag =
VAR _maxdate =
MAX ( 'Calendar'[Date] )
VAR _seltenure =
SELECTEDVALUE ( 'Tenure'[Tenure] )
VAR _selagent =
SELECTEDVALUE ( 'Sales'[AGENT NAME] )
VAR _pdate =
CALCULATE (
MAX ( 'Roster'[PRODUCTION DATE] ),
FILTER ( 'Roster', 'Roster'[AGENT NAME] = _selagent )
)
RETURN
IF (
_seltenure = ">= 60 Days"
&& DATEDIFF ( _pdate, _maxdate, DAY ) >= 60,
1,
IF ( _seltenure = "< 60 Days" && DATEDIFF ( _pdate, _maxdate, DAY ) < 60, 1, 0 )
)
2. Create a table visual as below screenshot and apply a visal-level filter on it with the condition (Flag is 1)
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards