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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
AliceW
Impactful Individual
Impactful Individual

ALLSELECTED(), but with one exception? Is this sorcery possible?

Hello everyone,

I have this big table and I created one measure to get the % from total.

From Total =

divide(

   [Amount],
    calculate([Amount],ALLSELECTED()
))
However, I have this Date table, whose column Year I use in a matrix.
I'd like the % to be 100% for each year.
At the moment, I get 100% for all years.
 
The expected result:
Value20222023
Fruits45%30%
Vegs55%70%
Total100%100%
 
Does anyone know how to solve this, please?
Thanks,
Alice
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @AliceW ,

Please try this:

From Total = 
DIVIDE(
    [Amount],
    CALCULATE([Amount], ALLSELECTED(),VALUES('Calendar'[Year]))
)

vcgaomsft_0-1696235936273.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

5 REPLIES 5
v-cgao-msft
Community Support
Community Support

Hi @AliceW ,

Please try this:

From Total = 
DIVIDE(
    [Amount],
    CALCULATE([Amount], ALLSELECTED(),VALUES('Calendar'[Year]))
)

vcgaomsft_0-1696235936273.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

AliceW
Impactful Individual
Impactful Individual

Thank you so much, Gao! It works great!

AliceW
Impactful Individual
Impactful Individual

Hi Sergej,

I'd like that each Year column gets its own 100%.

Like you get when displaying an amount as '% of column total'. Yes, this is the best example. The only reason why I'm NOT using this solution is because I'm bringing this measure into a Switch measure later on.

I hope it's clear and you can find a solution :0)

Thank you for reading,
Alice

Hey Alice,
like this, right?

sergej_og_0-1696235981861.png

If yes, try this:

% Part = 
VAR SalesCategory = 
    CALCULATE(
        [your_SUM_measure],
        ALLSELECTED(yout_table[Category])
    )

RETURN
DIVIDE([your_SUM_measure], SalesCategory)


Regards
Sergej

 

sergej_og
Super User
Super User

Hey Alice,
not clear to me what is your target layout.
What result would you like achieve?

Can you pls provide a Screen with your target and discription to that.

Helpful resources

Announcements
Europe Fabric Conference

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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