Reply
M_SBS_6
Helper V
Helper V

Aggregate values by Date selections

<span;>Hi, I have the following table below. As it stands using one days worth of data, this table works perfectly. My % column takes the value of a singular row and divides by the total of the value by ID.
<span;>
<span;>%=DIVIDE(
<span;>    [Value],
<span;> CALCULATE(
<span;>        SUM(Table1[Value]),
<span;>        ALLEXCEPT(Table1, Table1[ID])))

<span;>ID.   Value.   %
<span;>1         100.  10%
<span;>1.        100.  10%
<span;>1.         300.  30%
<span;>1.         500.  50%
<span;>2.         200.  40%
<span;>2.         100.  20%
<span;>2.          200. 40%

<span;>However, when I add another days worth of data in but filter on just one day (tw_date), the value reacts to the latest date and sums it correctly but the % column doesn't and it returns the percentage value based on the 2 days.

<span;>Any idea how to change this please so it reacts to the dates selected please

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@M_SBS_6 Well, I *think* the issue is your ALLEXCEPT removing the date context so probably need to include the column your slicer is based on within your ALLEXCEPT?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-xuxinyi-msft
Community Support
Community Support

Hi @M_SBS_6 

 

I added another date to the data you provided.

vxuxinyimsft_0-1706676499016.png

 

You can change the formula to something like this:

% = DIVIDE([Value], CALCULATE(SUM(Table1[Value]), ALLEXCEPT(Table1, Table1[ID], Table1[Date])))

 

vxuxinyimsft_1-1706676682980.png

Is this the result you expect?

 

Best Regards,
Community Support Team _Yuliax

 

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

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

@M_SBS_6 Well, I *think* the issue is your ALLEXCEPT removing the date context so probably need to include the column your slicer is based on within your ALLEXCEPT?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)