cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
luvagoldenk9
Helper II
Helper II

Measure to Sum Based on Multiple Selections in one Filter

Hello,

 

I am creating a measure to sum dollars by month: 

 

MonthlySum=CALCULATE(SUM('FileYTD'[Sales]),FILTER('FileYTD','FileYTD'[Month]=SELECTEDVALUE('FileYTD'[Month])))

 

Need to add Month as a filter and allow the user the ability to select multiple months or just one month. SELECTEDVALUE only works on one selected month. Any suggestions of how to change the measure to SUM on any number of selected months (or all months, or 3 months based, or whatever months the user selects)?

 

ALLSELECTED does not work either. Any thoughts or ideas would be appreciated. Thank you!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@luvagoldenk9 , first of all if you are selecting month from same table you do not need to add that to filter it should work

CALCULATE(SUM('FileYTD'[Sales]))

 

Above should filter from table and related tables 

 

even if you need a filter then

 

MonthlySum=

var _tab = summarize(allselected('FileYTD') , 'FileYTD'[Month])

return

CALCULATE(SUM('FileYTD'[Sales]),FILTER('FileYTD','FileYTD'[Month] in _tab ))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@luvagoldenk9 , first of all if you are selecting month from same table you do not need to add that to filter it should work

CALCULATE(SUM('FileYTD'[Sales]))

 

Above should filter from table and related tables 

 

even if you need a filter then

 

MonthlySum=

var _tab = summarize(allselected('FileYTD') , 'FileYTD'[Month])

return

CALCULATE(SUM('FileYTD'[Sales]),FILTER('FileYTD','FileYTD'[Month] in _tab ))

Thank you amitchandak!

 

The second version you suggested in your response above worked like a champ. Really do appreciate your assistance and help!! 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors