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
Eman
Frequent Visitor

show the oldest and newest values (disk used) by date not including blank or 0 values

I'm trying to create measures to:

  • First date (Only non-zero/blank diskused)
  • matching first date diskused size
  • last date (Only non-zero/blank diskused)
  • matching first date diskused sizes 
  • Difference between those first and last

 

 

Based on this https://community.powerbi.com/t5/Desktop/Find-value-for-first-and-last-date-by-person/td-p/61984 help I have tried to update those to filter to only the values that are not blank and not zero.

 

The problem is that Last and first are both returning the same values.

 

The measures I'm using:

FirstDiskUsed (sums over server names) =
SUMX (
VALUES( '123Combined_vw_DPM_Disk_Usage_Replica'[ProductionServerName] ),
CALCULATE ( MIN ( '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] ), FILTER( '123Combined_vw_DPM_Disk_Usage_Replica', '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] > 0 && '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] <> BLANK() && FIRSTDATE( '123Combined_vw_DPM_Disk_Usage_Replica'[StartDateTime] ) )
))

 

LastDiskUsed (sums over server names) =
SUMX (
VALUES( '123Combined_vw_DPM_Disk_Usage_Replica'[ProductionServerName] ),
CALCULATE ( MIN ( '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] ), FILTER( '123Combined_vw_DPM_Disk_Usage_Replica', '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] > 0 && '123Combined_vw_DPM_Disk_Usage_Replica'[DiskUsed] <> BLANK() && LASTDATE ( '123Combined_vw_DPM_Disk_Usage_Replica'[StartDateTime] )) )
)

 

Sample data:

 

ProductionServerName,DiskUsed,StartDateTime

server11125253121/1/2016 8:00
server11687879687/1/2018 7:00
server1562626567/8/2018 7:00
server1562626567/15/2018 7:00
server29.91383E+121/1/2014 8:00
server2303312322561/1/2014 8:00
server2472332001281/1/2014 8:00
server22.78859E+123/23/2014 7:00
server21.61244E+117/1/2018 7:00
server28.48197E+127/8/2018 7:00
server2539044249607/8/2018 7:00
server28.48198E+127/15/2018 7:00
server2536695439367/15/2018 7:00
server3 1/1/2014 8:00
server3300369018881/1/2014 8:00
server3463381381121/1/2014 8:00
server33.90742E+123/23/2014 7:00
server3196994007043/23/2014 7:00
server33.93733E+123/30/2014 7:00
server3472060887047/8/2018 7:00
server35.93578E+127/15/2018 7:00
server3526101135367/15/2018 7:00
server3472042577927/15/2018 7:00

 

 

DiskUsedChange (sums over Server Names) =
[LastDiskUsed (sums over server names)] - [FirstDiskUsed (sums over server names)]

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

That's because you need to use MAX instead of MIN in your LastDiskUsed measure.


@ 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...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

That's because you need to use MAX instead of MIN in your LastDiskUsed measure.


@ 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...

So, I don't want the largest and smallest numbers, I want the number associated with the oldest date and newest date... does that make sense? Meaning I need to see what the latest number is, and it won't always be the greatest number. Are these queries doing that?

That's a good question, I'll have to check on 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...

Thanks! Look forward to hearing back.

Thank you, so glad to have that sorted out after trying for so long and not seeing that simple thing!

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.

Top Solution Authors