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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sreddy47652
Helper II
Helper II

Based on month selection need to get amounts

Hi Team, I have Month year as an slicer and Total amounts in My Table. so when user click on the Month  i need to to get filter the data on below way. Can you please provide me the measures to achievce this.

1. Prior month total sales(Consider If user select May month, i need to show may month sales)

2. Last 12 month total sales(Last 12 months data)

3. Last month total sales.(April Month Sales)

4. Next month sales.(Consider if user selects an Feb then i need to show march sales)

1 REPLY 1
Kishore_KVN
Super User
Super User

Hello @sreddy47652 , If I understood your requirement correctly below measure will help you in achieving your requirement. But please check with column names and also create a month number column in your table to use this. 

Total Sales = 
Var SelectedMonth = Month(SelectedValue(Date))
Var CMSales = Calculate(Sum(Sales),Filter(Table,Table[Month]=SelectedMonth))
Var PTMSales = Calculate(Sum(sales),DateAdd(Dates,SelectedMonth-12,Month))
Var LMSales = Calculate(Sum(sales),Filter(Table,Table[Month] = SelectedMonth-1))
Var NMSales = Calculate(Sum(sales),DateAdd(Dates,SelectedMonth+1,Month))
Return
CMSales+PTMSales+LMSales+NMSales

 

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

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.