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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sabd80
Helper III
Helper III

DAX alternate between ALLSELECTED and ALL

Hi,

I have request from the business that needs an option to select ALLSELECTED or ALL, rather than creating 2 different measure can I have one measure and can select between either ALLSELECTED or ALL.

 

Avg Tonnes =
CALCULATE(
    DIVIDE([Jan FC], [Budget], 0
    ),ALLSELECTED()
)
 
Avg Tonnes =
CALCULATE(
    DIVIDE([Jan FC], [Budget], 0
    ),ALL(Colm1, colm2)
)
3 REPLIES 3
FreemanZ
Super User
Super User

hi @sabd80 ,

 

instead of alternating between functions, you can use field parameter to alternate between measures. check this:

 

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters

 

Thanks @FreemanZ, I am aware of the field parameter, my whole point for this post is to avoid creating another set of measures.

Hi @sabd80 ,

 

As far as I know, measure could return results dynamiclly based on filter context. However, we couldn't change the code in a measure dynamiclly.
Here I suggest you to follow sabd80’s solution, Field Parameter should be a good workaround.

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.