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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Manar
Helper II
Helper II

Pass multiple values from slicer into dax measure

Hi,

I am trying to filter the count of submissions by year and months selected by user (slicer),

I created a measure to get the count by year but in case of months, the end user can select multiple values (Jan, feb etc)

 

I wrote the following formula, but it only works when selecting one month not multiple

 

Submissions_CurrentyearValue =

 

                     var  YearValue= MAX(DimDateSubmission[Year])              

                    var MonthValue= ALLSELECTED('DimDateSubmission'[Month])                                                                     

 

                Return                                                                                                                    

                            Calculate(CountA(Submisions[Submission Number]), 

                                Filter (

 

                                 All(Submisions),  YEAR(Submisions[Submission Date]) = YearValue   && Month( Submisions[Submission Date]) =  MonthValue                                                          )                                                                                                                                                                               )

 

 

Is there any way to allow multiple selections on month slicer??

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @Manar

 

I think replacing the "=" with "IN" will solve your problem, so instead of

 

&& Month( Submisions[Submission Date]) =  MonthValue 

you might want to try

 

&& Month( Submisions[Submission Date]) IN  MonthValue 

Let me know if that solves your problem.

 

Hope this helps,

Parker

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hey @Manar

 

I think replacing the "=" with "IN" will solve your problem, so instead of

 

&& Month( Submisions[Submission Date]) =  MonthValue 

you might want to try

 

&& Month( Submisions[Submission Date]) IN  MonthValue 

Let me know if that solves your problem.

 

Hope this helps,

Parker

Hi all,

I have a similar issue, but instead I need to get the month with the MAX and MIN net sales from current year per selected Status type. The user can choose among 3 categories (individually or clicking 2 or all 3 of them). If 2 or 3 categories together are chosen, the MAX and MIN must give the respective resulting month of the combined sales from these categories. The current measure looks like this:

 

var Status=ALLSELECTED(Status[Status type])

return

calculate(sum(Orders[Amount]);filter((Orders);Orders[Status type] in Status ))

 

Unfortunately, this measure provides inside a Card the total cumulated sales of the selected categories (for combined categories or individually). By adding this measure into a Matrix, I can see the period breakdown.

 

However, if I replace SUM by MAX (see code below) I get always the maximum period BUT from one of the 3 categories. For instance, if the user selects the 3 categories together, the measure returns the max sales period from ONLY that category with the "highest max" among the 3 selected categories. This is wrong, because we expect to get the max sales period from the combined selected categories.

 

calculate(max(Orders[Amount])

 

Replacing SUM by MIN we get exactly the opposite result. The measure returns the min sales period from ONLY that category with the "lowest min" among the 3 selected categories, and not from the combined categories.

 

calculate(min(Orders[Amount])

 

I tried also to use SUMX, MAXX and MINX, the the result is the same.

What am I doing wrong?

 

Thank you very much in advance,

Gustavo

@Anonymous that worked!! thanks!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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