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
TimIDS
Regular Visitor

measure to show the change in count from a set of dates

Hi

 

I am struggling to get a measure to show the change in count below from the import date.  There is no pattern to what the import date will be.  So for example, the measure for row 2 should show 9727-9734 = -7.  And for row 3 9743-9727 = +16

 

Import Date      Count

28/02/2019      9734

13/03/2019      9727

28/03/2019      9743

 

Can anyone help?

 

 
 
5 REPLIES 5
parry2k
Super User
Super User

@TimIDS is it safe to say that logic is to compare the value from previous date? if yes, what happens if there are more than two records on previous date or it will never happen?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@TimIDS you can add a column like this

 

Diff Col = 
CALCULATE(
FIRSTNONBLANK( 'Import'[Count],1), 
FILTER( 'Import', 'Import'[Import Date] < EARLIER( 'Import'[Import Date] ) )
)

 

this will give you previous row value and now you can take a differnce between two columns to get the value.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

 thanks but I am getting below error:

 

EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

@TimIDS are you adding it is a measure or column?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi,

 

Yes to show the change in number from previous date.  The import is only ever done once on any given day so there will never be two dates the same. Also there is a time stamp as well, even if two imports were done on same day.

 

thanks

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.