Forum Discussion
Calculating a datediff measure amount with a filter
- Anonymous3 years ago
Hi Anonymous ,
According to your description, it seems it involves two tables: 'Cases' and 'Partner' and you want to get the count of partners who have the cases with datediff(from case created date to today) is 90~180 days. Am I right? If yes,you can follow the steps below to get it. Please find the details in the attachment.
1. Create two measures as below
MaxDateDiff = VAR _selpartner = SELECTEDVALUE ( 'Cases'[Partner ID] ) VAR _maxdate = CALCULATE ( MAX ( 'Cases'[CreateDate2] ), FILTER ( ALLSELECTED ( 'Cases' ), 'Cases'[Partner ID] = _selpartner ) ) VAR _datediff = DATEDIFF ( _maxdate, TODAY (), DAY ) RETURN _datediffCount of partner = CALCULATE ( DISTINCTCOUNT ( 'Cases'[Partner ID] ), FILTER ( 'Cases', [MaxDateDiff] >= 90 && [MaxDateDiff] <= 180 ) )2. Create a card visual
Best Regards
Hi Anonymous ,
According to your description, it seems it involves two tables: 'Cases' and 'Partner' and you want to get the count of partners who have the cases with datediff(from case created date to today) is 90~180 days. Am I right? If yes,you can follow the steps below to get it. Please find the details in the attachment.
1. Create two measures as below
MaxDateDiff =
VAR _selpartner =
SELECTEDVALUE ( 'Cases'[Partner ID] )
VAR _maxdate =
CALCULATE (
MAX ( 'Cases'[CreateDate2] ),
FILTER ( ALLSELECTED ( 'Cases' ), 'Cases'[Partner ID] = _selpartner )
)
VAR _datediff =
DATEDIFF ( _maxdate, TODAY (), DAY )
RETURN
_datediffCount of partner =
CALCULATE (
DISTINCTCOUNT ( 'Cases'[Partner ID] ),
FILTER ( 'Cases', [MaxDateDiff] >= 90 && [MaxDateDiff] <= 180 )
)
2. Create a card visual
Best Regards