Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi All ,
As per business requirement i need to display last 3 months data as a stacked bar chart (because i am using region wise data as a legend) .I have data until May23 , so in the visual i need to showcase only Mar,April,May data only .
Using year slicer as well .. if i select 2022 , then the visual should give Oct,Nov and Dec data as per requirement .
I have data like below only .
Month | Year | Volume | Value (Func. Currency) |
APR | 2023 | 1.38 | |
APR | 2023 | 6.60 | |
FEB | 2023 | 1.30 | |
FEB | 2023 | 3.47 | |
JAN | 2023 | 1.05 | |
JAN | 2023 | 2.64 | |
MAR | 2023 | 1.61 | |
MAR | 2023 | 2.84 |
currently it is showing all 4 months as i am selected 2023 in year slicer .
Please help to fix this asap ?
thanks in advance
dinesh
Hi @dinesharivalaga ,
Here are the steps you can follow:
1. Create calculated table.
2. Create measure.
Flag =
var _select=
SELECTEDVALUE('Table 2'[Year])
var _column=
SELECTCOLUMNS(
FILTER(ALL('Table'),
'Table'[Year]=_select),"Month",[Month])
var _maxdate=
MAXX(
FILTER(ALL('Table 2'),
'Table 2'[Year]=_select&&'Table 2'[Month] in _column),[Date])
var _mindate=
EOMONTH(
_maxdate,-3)+1
var _include=
SELECTCOLUMNS(
FILTER(ALL('Table 2'),
'Table 2'[Date]>=_mindate&&'Table 2'[Date]<=_maxdate),"1",[Month])
return
IF(
MAX('Table'[Year])=_select&&MAX('Table'[Month]) in _include,1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Anonymous thanks for your response ..
I have created the flag in my dashboard and applied the same but i got below error popup once flag filter applied ..
Please advise on this ?
Hi @dinesharivalaga check Relative date type of fitler. I hope this help
Proud to be a Super User!
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |