The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello All,
How to get the difference between two weeks, below is the example
Try this solution. In this example, the data table is WeekDiff.
Create calculated table:
WeekDiffDates = VALUES ( WeekDiff[Date] )
Create a relationship between WeekDiffDates and WeekDiff.
Create measures:
Count of Country = COUNT ( WeekDiff[Country] )
Difference =
VAR vDate =
MAX ( WeekDiffDates[Date] )
VAR vCurrentCount = [Count of Country]
VAR vPrevDate =
CALCULATE ( MAX ( WeekDiffDates[Date] ), WeekDiffDates[Date] < vDate )
VAR vPrevCount =
CALCULATE ( [Count of Country], WeekDiffDates[Date] = vPrevDate )
VAR vResult = vPrevCount - vCurrentCount
RETURN
vResult
In the matrix, columns should be WeekDiffDates[Date]:
Proud to be a Super User!
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
20 | |
12 | |
9 | |
7 |