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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nicolasvc
Helper III
Helper III

Add cells of the same column as appropriate DAX

 

I have a table in which I have the value of a product per day, store.

Store  Product  Day  Value
1A11000
1B2500
............
2A1300
2B2200
............
3A1800

 

And I need another column that has the sum of the value of store 1 with store 2, but that the value is stored only in store 1, and the rest remain the same, such as the following example table. For store 1, the sum value column will be the sum of store 2 of the product and the corresponding day. And for the other stores (2,3, ..) the value will be the same as value.

 

Store  Product  Day  Value  Sum value
1A110001300
1B2500700
...............
2A1300300
2B2200200
...............
3A1800800

 

But it has to be in DAX, since they are calculated columns and I can't see them in power query, how can I do this sum with restrictions?

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @nicolasvc ,

According to your description, you can write a single DAX measure, which is more easier.

vkalyjmsft_0-1635312581069.png

Best Regards,
Community Support Team _ kalyj

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

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

 

Picture1.png

 

Values total : =
SUM('Table'[Value] )
 
Condition Values total : =
SUMX (
SUMMARIZE ( 'Table', Stores[Store], Products[Product], Days[Day] ),
CALCULATE (
IF (
SELECTEDVALUE ( Stores[Store] ) = 1,
CALCULATE (
[Values total :],
FILTER ( ALL ( Stores ), Stores[Store] IN { 1, 2 } )
),
[Values total :]
)
)
)
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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