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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Avivek
Post Partisan
Post Partisan

Return multiple elements with selectedvalue dax function

I have a report which has Month Unit, Month Sales, Qtr Unit, Qtr Sales, Year Unit and Unit Sales.The report has slicers for Month, Qtr and Year. 

 

The measure created for the Month sales is;

Month sales = CALCULATE([Sales Amount],
FILTER(ALL('Date'),
'Date'[Month Name] = SELECTEDVALUE('Date'[Month Name])))
Avivek_0-1611581062168.png

 

There are 2 issues I face here, since its selectedvalue in the measure it returns value on only one selection, I want it to return values even on multiple selection.
 Secondly I would like to filter the Month Sales and Month Unit by Quarter and Year also.
 Although adding the similar filter in the measure for quarter and year seems to work but it also should work on the similar concept where selecting multiple quarter or years the measure returns the value.
 

 

 

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Avivek ,

 

Try to use "IN" and "VALUES" like so:

Month sales =
CALCULATE (
    [Sales Amount],
    FILTER ( ALL ( 'Date' ), 'Date'[Month Name] IN VALUES ( 'Date'[Month Name] ) )
)

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

 

Payeras_BI
Super User
Super User

Hi @Avivek,

 

Please confirm if this is your expected output:

 

Let's say you select month JAN and FEB, year 2014 and no selection for Quarter.

 

Month Sales = Sales for 2014 JAN + 2014 FEB

Quarter sales = Sales for all 2014 1Q

Year Sales = Sales for all 2014

 

Is this what you want? If not detail further.

Payeras_BI_0-1611673833499.png

 

 

Regards,

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Payeras_BI
Super User
Super User

Hi @Avivek ,

 

What about using ALLSELECTED like below:

 

MONTH SALES =
CALCULATE ( [Sales Amount], ALLSELECTED ( 'Date'[Month Name] ) )

 

Regards,

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Anonymous
Not applicable

WHy not create a date calendar with Year, Quarter and Month as Columns.

Then link your date calendar to you sales table on Date column.

 

Then create slicers on the Year / Qrtr / Month column of the date table

 

It saves you the trouble of working with DAX

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.