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.
Hello All
I need some help with the following satiation
I have to show the previous months values when I select a month from the slicer (the month order is from July 2019 to June 2020)
If I select July I need to see just the July value
or
If I select any other month like November I have to show from July to November
or
If I select any other month like January I have to show from July to January
My table:-
i have a table
METRIC_CONFIG_ID | Year | Month | METRIC_VALUE_MTM |
401 | 2019 | July | 493 |
401 | 2019 | August | 484 |
401 | 2019 | September | 634 |
401 | 2019 | October | 409 |
401 | 2019 | November | 400 |
401 | 2019 | December | 304 |
401 | 2020 | January | 445 |
401 | 2020 | February | 189 |
401 | 2020 | March | 100 |
401 | 2020 | April | |
401 | 2020 | May | |
401 | 2020 | June | |
402 | 2019 | July | 219 |
402 | 2019 | August | 323 |
402 | 2019 | September | 404 |
402 | 2019 | October | 363 |
402 | 2019 | November | 665 |
402 | 2019 | December | 321 |
402 | 2020 | January | 370 |
402 | 2020 | February | 215 |
402 | 2020 | March | 0 |
402 | 2020 | April | |
402 | 2020 | May | |
402 | 2020 | June | |
403 | 2019 | July | 891 |
403 | 2019 | August | 1559 |
403 | 2019 | September | 959 |
403 | 2019 | October | 1623 |
403 | 2019 | November | 1479 |
403 | 2019 | December | 1933 |
403 | 2020 | January | 1263 |
403 | 2020 | February | 1615 |
and i have the month as a slicer as shown below
the issue i am having is when i select a month in the slicer i should display all the previous months values all
Example :-
when i select a month let’s say July i able to get the line graph with only July month value which is right, because the month in my table starts with July (July 2019 to June 2020)
My Issue:-----
but when i select any other month, lets take November i should display from July to November
(not just November as shown in the image below )
Hi @Anonymous ,
I created a sample. Please have a try to check if it is what you want.
Measure =
VAR SelectedMonth =
SELECTEDVALUE ( 'Month'[MonthNo.] )
VAR SelectedYear =
IF ( SelectedMonth <= 6, 2020, 2019 )
RETURN
SWITCH(SelectedYear,
2019,
CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
FILTER (
'Table',
'Table'[Year] = SelectedYear
&& 'Table'[MonthNo.] <= SelectedMonth
)
),
2020,
CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
FILTER (
'Table',
'Table'[Year] = SelectedYear
&& 'Table'[MonthNo.] <= SelectedMonth
)
)
+ CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
'Table'[Year] = SelectedYear - 1
)
)
For more details, please download the attachment below.
Hi there,
Thanks for the approach,
But the data table I was shown is just an example I have multiple years of data not just 2019 and 2020
can we keep the year dynamic not just to limit that to 2019 and 2020
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |