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.
I have a series of KPIs that I display in a table side by side for each location within the business.
I want to add the last week performance of each KPI to the table along side the current week. However using DATEADD doesn't appear to change the output.
I'm using a page level filter to slice the data to the last 7 days in the table.
As you can see below the output of [LW KPI 1] is the same as the measure it directly references. The DAX in use is:
LW KPI 1 % Jobs Completed on Time = CALCULATE([KPI 1 % Jobs Completed on Time], DATEADD(Jobs[Date Range
Jobs].[Date], -7, DAY))
Any idea why the DATEADD filter is being ignored?
Solved! Go to Solution.
@Anonymous,
It might be caused by date hierarchy. Try to remove .[Date] from the formula above.
@Anonymous,
It might be caused by date hierarchy. Try to remove .[Date] from the formula above.
Sorry I did reply to this, but it doesn't appear to have posted.
Removing .[date] hierarchy introduces a duplicate values error for DATEADD.
So I wrote the following, using the VALUES function to give me a distinct list of dates for each DATEADD function, but get the same duplicates error.
Any ideas?
KPI Score Last Week = var Dates = VALUES(Reports[Date Range]) var KPI1LW = CALCULATE([KPI 1 %], DATEADD(Dates,-7, DAY)) var KPI2LW = CALCULATE([KPI 2 %], DATEADD(Dates, -7, DAY)) var KPI3LW = CALCULATE([KPI 3 %],DATEADD(Dates, -7, DAY)) var KPI4LW = CALCULATE([KPI 4 %],DATEADD(Dates, -7, DAY)) VAR KPI1Score = IF(KPI1LW > [KPI 1 Target], 1, 0) VAR KPI2Score = IF(KPI2LW > [KPI 2 Target], 1, 0) VAR KPI3Score = IF(KPI3LW > [KPI 3 Target], 1, 0) VAR KPI4Score = IF(KPI4LW > [KPI 4 Target], 1, 0) RETURN KPI1Score + KPI2Score + KPI3Score + KPI4Score
User | Count |
---|---|
60 | |
55 | |
53 | |
49 | |
30 |
User | Count |
---|---|
179 | |
87 | |
70 | |
48 | |
45 |