Forum Discussion
Count of mixed values(text-integer)
- 4 years ago
Hi, Anonymous ;
My DAX below returns incorrect results like: "303 hours < 168 hours: Yes", "5 days < 7 days: No"
IF('Source'[Case type]="A" && 'Source'[Time passed till now]>168 & " hours", "Yes","No")IF('Source'[Case type]="B" && 'Source'[Time passed till now]>7 & " days", "Yes","No")IF('Source'[Case type]="C" && 'Source'[Time passed till now]>7 & " days", "Yes","No")You could create a column :
column = var _num=CONVERT( LEFT([Time passed till now], SEARCH(" ",[Time passed till now])),INTEGER) return IF(('Source'[Case type]="A"&&_num>168)|| (('Source'[Case type]="B"||'Source'[Case type]="C") &&_num>7), "Yes","No")The final output is shown below:
My desired output would be to count for all of these cases - how many are older than 1 week?
You could create a measure.
count = CALCULATE(COUNT([Case type]),FILTER(ALLSELECTED(Source),DATEDIFF([Latest comment date],NOW(),HOUR)>7*24))The final output is shown below:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous ;
My DAX below returns incorrect results like: "303 hours < 168 hours: Yes", "5 days < 7 days: No"
IF('Source'[Case type]="A" && 'Source'[Time passed till now]>168 & " hours", "Yes","No")IF('Source'[Case type]="B" && 'Source'[Time passed till now]>7 & " days", "Yes","No")IF('Source'[Case type]="C" && 'Source'[Time passed till now]>7 & " days", "Yes","No")
You could create a column :
column =
var _num=CONVERT( LEFT([Time passed till now], SEARCH(" ",[Time passed till now])),INTEGER)
return IF(('Source'[Case type]="A"&&_num>168)||
(('Source'[Case type]="B"||'Source'[Case type]="C") &&_num>7),
"Yes","No")
The final output is shown below:
My desired output would be to count for all of these cases - how many are older than 1 week?
You could create a measure.
count =
CALCULATE(COUNT([Case type]),FILTER(ALLSELECTED(Source),DATEDIFF([Latest comment date],NOW(),HOUR)>7*24))
The final output is shown below:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.