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
morther
Helper I
Helper I

Subtracting a cell value from a another cell (measure) in a single column

I have a Measure with a value of 131 that I call "Active Devices". I have field called Maintenance[Devices] which is a count of devices that have had maintenance.

 

I have a Card that Counts the number of Devices with with Maintenance. It is calculating properly at 125.

I would like to have a count of devices which Did Not have Maintenance, so I would like to take the Total Active Devices (131) and subtract Count of Devices with Maintenance (125) and have a result of (6).

 

I tried the following, but the result is always 125.

 

NoMaint = Maintenance[TotalActiveDevices] - (COUNT(Maintenance[DEVICE_ID]))

 

NoPMCount = ImportCubicPM[TotalActiveDevices] - CALCULATE(COUNT(ImportCubicPM[DEVICE_ID]))

 

any ideas?

 

Thanks in advance

1 ACCEPTED SOLUTION
GilbertQ
Super User
Super User

Hi @morther

 

What I would suggest is to create seperate measures for each of your requirements.

 

And then you can calculate your final measure by using the two previous measures as shown below.

 

 

Active Devices = COUNT('ImportCubicPM'[TotalActiveDevices])

Maintenance Devices = COUNT('ImportCubicPM'[Device_ID])

Devices with No Maintenance = [Active Devices] - [Maintenance Devices]

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

 

I suspect it has to do with some table relationship missing.  Share your file.


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

I wanted to share my file but not sure how to do that here.  Are you talking about the pbix file?

Hi @morther,

 

Yes ideally your pbix file.

 

Ninter

I have this file all ready to attach, but i do not see any way to do that.  Any ideas?

Greg_Deckler
Super User
Super User

Tough without sample data, but you want a measure that is like:

 

All Devices = CALCULATE(COUNT([Column]),[Active]="Yes")

Subtract your maintenance measure from that.

 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
GilbertQ
Super User
Super User

Hi @morther

 

What I would suggest is to create seperate measures for each of your requirements.

 

And then you can calculate your final measure by using the two previous measures as shown below.

 

 

Active Devices = COUNT('ImportCubicPM'[TotalActiveDevices])

Maintenance Devices = COUNT('ImportCubicPM'[Device_ID])

Devices with No Maintenance = [Active Devices] - [Maintenance Devices]

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Below is what I actually did, which is very similar to your calculation.

 

No PM = Drive_Station[AD] - COUNT(Drive_Station[Device_ID])

 

Thank you so much.

Awesome glad you got it working




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

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.