cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nielsrask
Regular Visitor

DAX Formula for subtracting columns?

Hi, I have created a matrix table from my data base.

 

Now, I would like to subtract two of the columns from each other and put the result in a new column.

 

Can I do it directly in the visual or is it possible for me to convert my Matrix Table visual to a query?

 

ThanksUntitled.png 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-yuezhe-msft
Moderator

Re: DAX Formula for subtracting columns?

@nielsrask,

Create the following measures in your table and drag the result measure in your visual.

totalforspecies = CALCULATE(SUM('EKRN-a482911f-cdbf-4b5f-9e2d-8cde02e7f164-31_05_2017_clean july 2017'[species-count]))

totalforblankaction = CALCULATE([totalforspecies],'EKRN-a482911f-cdbf-4b5f-9e2d-8cde02e7f164-31_05_2017_clean july 2017'[action-taken]="")

result = [totalforspecies]-[totalforblankaction]

For more details, please review the attached PBIX file.

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

3 REPLIES 3
Interkoubess Solution Sage
Solution Sage

Re: DAX Formula for subtracting columns?

Hi @nielsrask,

 

If you can five us a sample it will be great.

If I get what you are talking about, why not using a simple sum but the blank.

I am looking forward receiving your sample data.

Thanks,

 

nielsrask
Regular Visitor

Re: DAX Formula for subtracting columns?

Hi @Interkoubess, thanks for your reply, much appreciated!

 

Here is a sample: https://ascendaps-my.sharepoint.com/personal/nra_ascend_xyz/_layouts/15/guestaccess.aspx?docid=11e43...

 

As you can see, I have created the Matrix table on page 2 and would like to subtract the 'blank column' from the 'total' column and display the resut in a new column in the matrix table.

 

I would be happy, if I could just add the matrix table to my queries:-) 

Moderator v-yuezhe-msft
Moderator

Re: DAX Formula for subtracting columns?

@nielsrask,

Create the following measures in your table and drag the result measure in your visual.

totalforspecies = CALCULATE(SUM('EKRN-a482911f-cdbf-4b5f-9e2d-8cde02e7f164-31_05_2017_clean july 2017'[species-count]))

totalforblankaction = CALCULATE([totalforspecies],'EKRN-a482911f-cdbf-4b5f-9e2d-8cde02e7f164-31_05_2017_clean july 2017'[action-taken]="")

result = [totalforspecies]-[totalforblankaction]

For more details, please review the attached PBIX file.

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors