Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello Team,
I have 3 years of data and counting in my data set. Date column is in the format of 2018.02, 2018.03 etc..I should have two slicers to select year and month. Based on the selection of slicers I need to show previous 12 months of data. Can I achieve this using paramters? If yes, can you show me the way please. It should be flexible to change the values as well to view different range of date values of data.
Also appreciated, if the solution can work for Power BI service as well.
Ex:
Parameter 1 : 2017, Paramter 2: 08
Output should be like:
2016.09 to 2017.08 data
Thanks in advance.
Regards,
Shiva
You may try to create measure as below. Here is the reference for you.
Measure = VAR par1 = SELECTEDVALUE ( 'Slicer'[Year] ) VAR par2 = SELECTEDVALUE ( 'Slicer'[Month] ) RETURN CALCULATE ( MAX ( 'Table'[YearMonth] ), FILTER ( 'Table', 'Table'[Date] >= EDATE ( DATE ( par1, par2, 31 ), -11 ) && 'Table'[Date] <= DATE ( par1, par2, 31 ) ) )
Sample file is here.
Regards,
Cherie
Hello Team,
I have 3 years of data and counting in my data set. Date column is in the format of 2018.02, 2018.03 etc..I am having two slicers to select year and month. Based on the selection of slicers I need to show previous 12 months of data.
Also appreciated, if the solution can work for Power BI service as well.
Ex:
Slicer 1 : 2017, Slicer 2: 08
Output should be like:
2016.09 to 2017.08 data
Thanks in advance.
Regards,
Shiva
Basically something along the lines of:
Measure = VAR __param1 = MAX('Table'[Parameter 1]) VAR __param2 = MAX('Table'[Parameter 2]) RETURN SUMX(FILTER('Table',([Year]>=__param1-1&&[Month>__param2)&&([Year]=__param1&&[Month]<=__param2)),[Data])
Tough to be specific without data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490