cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper III

## Add a column for row totals

Hi,
How do I add a column that show a total for each row?

1 ACCEPTED SOLUTION
Impactful Individual

Total = SUMX(q2, q2[Antal lan lantagare under 18]+q2[Antal lan vuxna lantagare]+q2[Antal lán bibliotek]+q2[Antal lán TBK])

12 REPLIES 12
Impactful Individual

@Johan-MTM , If the simple objective is to have a column that is the sum data in each row. For ex, the new column value for "Angereds bibliotek" is 34, then

Total = q2[Antal lan lantagare under 18]+q2[Antal lan vuxna lantagare]+q2[Antal lán bibliotek]+q2[Antal lán TBK]

should work.

If a measure is required,

Total = SUMX(q2, q2[Antal lan lantagare under 18]+q2[Antal lan vuxna lantagare]+q2[Antal lán bibliotek]+q2[Antal lán TBK])
should do the trick.
Helper III

How would the DAX look like if I want to create a new measure?

Impactful Individual

Total = SUMX(q2, q2[Antal lan lantagare under 18]+q2[Antal lan vuxna lantagare]+q2[Antal lán bibliotek]+q2[Antal lán TBK])

Helper III

Sorry @ChiragGarg2512 , I didn't see your reply before I posted my question!

I tried a new measure with your sugestion but got an error:

Impactful Individual

change the table name to what you have.

Helper III

Total = SUMX(q2, q2[Antal lån låntagare under 18]+q2[Antal lån vuxna låntagare]+q2[Antal lån bibliotek]+q2[Antal lån TBK])
I'm sorry but I don't get it 🙂 The error message points to "q2", should I replace this with something?

Impactful Individual

@Johan-MTM , q2 is name of the table in my pc, replace it with the name of table in your system.

Helper III

Alright, here we go 🙂 All the tables but the first one (Bibliotek) are measures so this worked fine!

Total = SUMX('public loan',[Antal lån låntagare under 18]+[Antal lån vuxna låntagare]+[Antal lån bibliotek]+[Antal lån TBK])

One thing tho - Its the same result if I have Public loan or Public library or any other table name as format, why is that? Does it matter?

Impactful Individual

@Johan-MTM , This is because the measure once created are part of the model rather than that particular table. These measures can be acessed from anywhere without the name of table being attached to it, the names can be attached but it will work either way.

Thank You, if this solves the issue mark it as solution so that the community can fnd the solution easily.

Helper III

Thank you! NOw I understand a bit more, but I do need to have seomthing there in order fpr it to work? If I remove the table name I get "Too few arguments..."

Total = SUMX([Antal lån låntagare under 18]+[Antal lån vuxna låntagare]+[Antal lån bibliotek]+[Antal lån TBK])
Impactful Individual

@Johan-MTM , I meant the name attached to measure, like 'table'[measure] and [measure] work the same way. The reason for "Too few argument" is that the function sumx require twoarguments, name of the table and the expression. The name of the table is not optional.

https://learn.microsoft.com/en-us/dax/sumx-function-dax

Super User

hello @Johan-MTM either try using a matrix table or create a new measure that sums up all your measures and name it total

Announcements

#### Power BI Monthly Update - November 2023

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

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors