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
mgtaylor3
Helper I
Helper I

summarized table with a dynamic filter Is it possible?

Hi , I need some help to create the following summarized table.
 
I have a revenue_data table i need to summarize .  At the moment I have to manually enter the 2019  to get this table to run.
 
 I'd like it to run when i choose a Year from a slicer if possible?  to be even better, to choose the previous year of the chosen year.
 
 
 so 2020   I'd like 2019  from the code below can it be done?
 
 
 
March_Table =
CALCULATETABLE(
SUMMARIZE(
Revenue_Data,
[Country],[TERRITORY_DETAILED_DESCRIPTION],[BASE_AMOUNT],[DATE])
,FILTER('Revenue_Data',
year(Revenue_Data[DATE])= 2019)
 
)
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@mgtaylor3 

 

Try this code please:

March_Table =
CALCULATETABLE(
SUMMARIZE(
Revenue_Data,
[Country],[TERRITORY_DETAILED_DESCRIPTION],[BASE_AMOUNT],[DATE])
,FILTER('Revenue_Data',
year(Revenue_Data[DATE])= YEAR(SELECTEDVALUE(Revenue_Data[DATE]))-1)
 
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
mgtaylor3
Helper I
Helper I

ah... 

 

So in a measure how will  this look?

Fowmy
Super User
Super User

@mgtaylor3 

if you are creating a calculated table, you cannot include the slicer values coming from your report. If you are going to use this code inside a measure, it will work.

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

mgtaylor3
Helper I
Helper I

Ok  Unfortunately not....yet... let me change it a wee bit.

 

March_Table =
CALCULATETABLE(
SUMMARIZE(
Revenue_Data,
[Country],[TERRITORY_DETAILED_DESCRIPTION],[BASE_AMOUNT],[DATE],Revenue_Data[FIN_YEAR])
,FILTER('Revenue_Data',
Revenue_Data[FIN_YEAR]= SELECTEDVALUE('Calendar'[FIN_YEAR])-1
)
 
So I'm trying this.... 
 
I have on a page a slicer for financial year.... I shoose 2020  and i need that to be 2019 in the filter.. so the assumption is the selected value does this?
 
 there is a link the the calendar table  from the original revenue_data table.
 
I just can't get this to work...
 
)
Fowmy
Super User
Super User

@mgtaylor3 

 

Try this code please:

March_Table =
CALCULATETABLE(
SUMMARIZE(
Revenue_Data,
[Country],[TERRITORY_DETAILED_DESCRIPTION],[BASE_AMOUNT],[DATE])
,FILTER('Revenue_Data',
year(Revenue_Data[DATE])= YEAR(SELECTEDVALUE(Revenue_Data[DATE]))-1)
 
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thanks! This was really useful

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