Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
I have a dataset where i need to track repeat event logged for 0-3, 4-10, 10-30 and >30 for a unique events occuring in a month.
So the columns are as per below , i add a calculated column to capture first report date for each line item and calculate the "Gap"
Then i create a measure to check records >30 days and <30 days . Problem is in below screenshot the >30 appears for Aug'22 for Tel # 123 but it is actually >30 days from the event from July'22
What measure should i use to calculate >30 so that it gets reported in July'22 itself as per screenshot below
Solved! Go to Solution.
hi @Jason6
here is my suggestion for each of measures:
> 30 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 30)
RETURN IF(ISBLANK(tmp), 0, tmp)
< 15 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
AND('Table'[Gap] - SELECTEDVALUE('Table'[Gap]) < 15, 'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 3))
RETURN IF(ISBLANK(tmp), 0, tmp)
< 3 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
AND('Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 0, 'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) < 3))
RETURN IF(ISBLANK(tmp), 0, tmp)
The idea is to check if there are any records in future including next months.
hi @Jason6
here is my suggestion for each of measures:
> 30 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 30)
RETURN IF(ISBLANK(tmp), 0, tmp)
< 15 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
AND('Table'[Gap] - SELECTEDVALUE('Table'[Gap]) < 15, 'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 3))
RETURN IF(ISBLANK(tmp), 0, tmp)
< 3 =
var tmp = CALCULATE(DISTINCTCOUNT('Table'[Tel #]),
ALL('Table'),
'Table'[Tel #] = SELECTEDVALUE('Table'[Tel #]),
'Table'[DateReported] > SELECTEDVALUE('Table'[DateReported]),
AND('Table'[Gap] - SELECTEDVALUE('Table'[Gap]) > 0, 'Table'[Gap] - SELECTEDVALUE('Table'[Gap]) < 3))
RETURN IF(ISBLANK(tmp), 0, tmp)
The idea is to check if there are any records in future including next months.
You will need a column that defines the month/year for the first reported event. The month column you are currently using appears to be based on the date reported.
Create the new month column and use that in your visual and you should end up with the desired result.
Proud to be a Super User! | |
User | Count |
---|---|
101 | |
68 | |
58 | |
47 | |
46 |