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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
kunal_mehta1
Helper I
Helper I

Dax to Sum Rows

Hi All,
I want to have dax expression for power BI to sum multiple rows.
I want a measure which would sum the dollar value of A1 and dollar value of B1 and give me a total of 30.
Thanks.
Sample.PNG

1 ACCEPTED SOLUTION

Hi, @kunal_mehta1 

 

You can try the following methods.
Column:

Number = RIGHT([Project Number],4)

vzhangti_0-1681803285890.png

Measure = CALCULATE(SUM('Table'[Dollar]),ALLEXCEPT('Table','Table'[Number]))

vzhangti_1-1681803378976.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your expected outcome of a visualization looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1680665729531.png

 

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

FreemanZ
Super User
Super User

hi @kunal_mehta1 

try like:

measure =
CALCULATE(
   SUM(TableName[Dollar]),
   TableName[ProjectNumber] IN {"A1", "B1"}
)

Sorry, i would like to elaborate a little.
I have projects with C number and out of those C projects i have few O projects with the same last 4 digits.
I want to sum the dollar values of C and O for that particular project with same last 4 digits.
I want a measure which would sum the C and O rows with same last 4 digits and if it doesn't have the O number just give the value of C number row.
I hope that this makes it clear.
Sample.PNG

@kunal_mehta1 

could you also provide directly your expected result based on the sampledata?

It would be a measure which will give me sum of dollar vlaue for C7097 and O7097 which would be 30 , next gives me sum of C7088 and O7088 which would be 35, also gives me the value of C7086 even if it doesn't have O number which would be 25.

Hi, @kunal_mehta1 

 

You can try the following methods.
Column:

Number = RIGHT([Project Number],4)

vzhangti_0-1681803285890.png

Measure = CALCULATE(SUM('Table'[Dollar]),ALLEXCEPT('Table','Table'[Number]))

vzhangti_1-1681803378976.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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