Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
freakinaditya
Helper II
Helper II

Dynamically show data from current selection in slicer till max year in data.

Hello Community!

 

I have a business requirement where I have to show data as follows-

 

freakinaditya_0-1662461893633.png       freakinaditya_1-1662461930267.png

 

Suppose I have year slicer, when I select a year from the slicer then it should show data from selected year till current year (i.e 2017) in this case. Value will be added up in each row as shown.

 

If I select 2017 then it should show only 2017-18 data.

freakinaditya_2-1662463316872.png freakinaditya_3-1662463339629.png

It should be dynamically changing with the year selected in the slicer till max of year.

 

Can anyone help and guide me in this?

 

Thanks in advance! 

  

 

 

 

 

4 REPLIES 4
jatinjoshi098
New Member

HI, I have a solution for this 

we can create a new table using summarize function like this 

Year =
GENERATE (
    SUMMARIZE( Summary, Summary[Year] ),
    VAR StartYear = Summary[Year]
    RETURN
        ADDCOLUMNS (
            GENERATESERIES ( StartYear, 2023 ),
            "s_year", StartYear,
            "e_year", [Value]
        )
)

jatinjoshi098_0-1688469938002.png

and than we can use year in the slicer and put year range in table and respective so that we can get the desired result 

jatinjoshi098_1-1688470108756.png

PFA 

 

 

Best Regards,

Jatin Joshi

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


amitchandak
Super User
Super User

@freakinaditya , Not very clear. But if select data for 1 year and want to show more than that , then slicer need to me on an independent date/year table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _min= Minx(allselected(Date1),Date1[Year])
var _max= maxx(allselected(Table),Table[Year]) //year in the table
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

 

Hi @amitchandak , Thank you for your response.

Actually, I wanted to display data in the same format as shown. A year and then its corresponding value.

if user select a single year (e.g 2014) then it should show all the value from the selected year till the maximum year present in the data(e.g -2018 in this case)
2014-15 #value
2014-16 #value
2014-17 #value
2014-18 #value
and if user select 2016 in  year slicer then output should be like this-
2016-17 #value
2016-18 #value

and if user select 2018(which is max year in data) in  year slicer then output should be like this-
2018-19 #value (only single entry)

 

Data should be represented in the same tabular format as below-

freakinaditya_0-1662472838970.png

 

HI, I have a solution for this 

we can create a new table using summarize function like this 

Year =
GENERATE (
    SUMMARIZESummarySummary[Year] ),
    VAR StartYear = Summary[Year]
    RETURN
        ADDCOLUMNS (
            GENERATESERIES ( StartYear2023 ),
            "s_year"StartYear,
            "e_year"[Value]
        )
)

jatinjoshi098_0-1688470362895.png

 

and than we can use year in the slicer and put year range in table and respective so that we can get the desired result 

jatinjoshi098_1-1688470362892.png

 

PFA 

 

 

Best Regards,

Jatin Joshi

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors