Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I have some data that is visits to a website which looks like this:
Date | VisitID |
08/01/2016 | 111366 |
09/01/2016 | 373823 |
10/01/2016 | 608594 |
11/01/2016 | 111366 |
10/01/2016 | 887988 |
13/01/2016 | 255210 |
14/01/2016 | 693369 |
10/01/2016 | 928357 |
14/01/2016 | 299080 |
09/01/2016 | 693369 |
So the dates arn't summed and the uniqueID can be on multiple dates. What I need is to be able to calculate the difference in counts of the amount of people (by VisitID). In Excel its easy to get a pivot of the dates and the count of visit id (but not distinct count). I then need it to work out the day on day difference in visits.
Essentially I need to recreate this:
Date | DistinctCountOfVisitID | DaybydayDifference | %Diff |
08/01/2016 | 1 | ||
09/01/2016 | 2 | 1 | 200% |
10/01/2016 | 3 | 1 | 150% |
11/01/2016 | 1 | -2 | 33% |
13/01/2016 | 1 | 0 | 100% |
14/01/2016 | 2 | 1 | 200% |
Any help would be appreciated.
Solved! Go to Solution.
@tjtommtjthese 2 Measures should do it...
MEASURE 1
DayByDayDifference = VAR CurrentDate = MIN ( 'Table'[Date ] ) VAR PreviousDate = CALCULATE ( MAX ( 'Table'[Date ] ), 'Table'[Date ] < CurrentDate ) RETURN DISTINCTCOUNT ( 'Table'[VisitID] ) - CALCULATE ( DISTINCTCOUNT ( 'Table'[VisitID] ), 'Table'[Date ] = PreviousDate )
MEASURE 2
% Difference = VAR CurrentDate = MIN ( 'Table'[Date ] ) VAR PreviousDate = CALCULATE ( MAX ( 'Table'[Date ] ), 'Table'[Date ] < CurrentDate ) RETURN DIVIDE ( DISTINCTCOUNT ( 'Table'[VisitID] ), CALCULATE ( DISTINCTCOUNT ( 'Table'[VisitID] ), 'Table'[Date ] = PreviousDate ) )
And the results...
Hope this helps!
Good Luck!
@tjtommtjthese 2 Measures should do it...
MEASURE 1
DayByDayDifference = VAR CurrentDate = MIN ( 'Table'[Date ] ) VAR PreviousDate = CALCULATE ( MAX ( 'Table'[Date ] ), 'Table'[Date ] < CurrentDate ) RETURN DISTINCTCOUNT ( 'Table'[VisitID] ) - CALCULATE ( DISTINCTCOUNT ( 'Table'[VisitID] ), 'Table'[Date ] = PreviousDate )
MEASURE 2
% Difference = VAR CurrentDate = MIN ( 'Table'[Date ] ) VAR PreviousDate = CALCULATE ( MAX ( 'Table'[Date ] ), 'Table'[Date ] < CurrentDate ) RETURN DIVIDE ( DISTINCTCOUNT ( 'Table'[VisitID] ), CALCULATE ( DISTINCTCOUNT ( 'Table'[VisitID] ), 'Table'[Date ] = PreviousDate ) )
And the results...
Hope this helps!
Good Luck!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |