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 a calendar table which has columns Year and Period that I'm using as slicers:
I'm using these to filter out data from 6 data tables; these 6 tables also contain the columns Year and Period. When I previously had data for Year 19-20 only the figures were calculated correctly but when I've now added data for Year 20-21 I'm getting a summation of Years 19-20 and 20-21 instead of just the Year and Period selected.
I have the following data as an example:
The slicers are as follows:
When I select the Year and Period then the calculations are made based on this user selection. I have the following KPIs that I'm calculating:
Solved! Go to Solution.
A bit tricky, but a disconnected table trick and this measure later and I think I got it. PBIX is attached:
SIP Actual Line Chart =
VAR __Year = MAX('SIP_Activities'[Year])
VAR __Period = MAX('SIP_Activities'[Period]) + 0
VAR __LinePeriod = MAX('Periods'[Period]) + 0
VAR __Table = FILTER(ALL(SIP_Activities),[Year] = __Year && [Period]+0 <= __Period)
VAR __Table1 = FILTER(__Table,[Period]+0 = __LinePeriod)
RETURN
SUMX(__Table1,[Actual-LD]) + SUMX(__Table1,[Late Delivery])
Thank you very much @Greg_Deckler , that did the trick.
If I want to apply this to other tables and columns, do I need to change anything such as the variable names?
The variable names can stay the same, the overall name of the measure needs to be unique
SIP Actual Line Chart =
VAR __Year = MAX('SIP_Activities'[Year])
VAR __Period = MAX('SIP_Activities'[Period]) + 0
VAR __LinePeriod = MAX('Periods'[Period]) + 0
VAR __Table = FILTER(ALL(SIP_Activities),[Year] = __Year && [Period]+0 <= __Period)
VAR __Table1 = FILTER(__Table,[Period]+0 = __LinePeriod)
RETURN
SUMX(__Table1,[Actual-LD]) + SUMX(__Table1,[Late Delivery])
Red is the measure name, has to be unique. Green are table names that you would update. Blue is column names that you would update. You could leave the measure names the same although the names may not make total sense depending on your tables/periods, etc. that you are switching things to.
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 |
---|---|
113 | |
103 | |
76 | |
66 | |
63 |
User | Count |
---|---|
142 | |
105 | |
102 | |
81 | |
68 |