Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Current Value - Previous Value

Im Trying to Achive Current value - Previous Value for a non Dates dataset , I have got the result using Offset function however when im trying to integrate the same measure into an existing measure im not able to get the correct result. 


I need help if there is any other way to achive current value - Previous value using dax measure 

1 ACCEPTED SOLUTION
v-xuxinyi-msft
Community Support
Community Support

Hi @Anonymous 

 

Maybe you can try to use the EARLIER function, but this function only works for the calculated column.

 

For details on its usage, you can refer to the following documentation:

EARLIER function (DAX) - DAX | Microsoft Learn

 

Here is an example:

 

Sample:

vxuxinyimsft_0-1707360773799.png

 

Create a calculated column as follows

 

Column = CALCULATE(MAX('Table'[NAME]), FILTER('Table', [ID] < EARLIER('Table'[ID]) && [Category] = EARLIER('Table'[Category])))

 

 

vxuxinyimsft_1-1707360969514.png

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Community Support Team _Yuliax

 

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
v-xuxinyi-msft
Community Support
Community Support

Hi @Anonymous 

 

Maybe you can try to use the EARLIER function, but this function only works for the calculated column.

 

For details on its usage, you can refer to the following documentation:

EARLIER function (DAX) - DAX | Microsoft Learn

 

Here is an example:

 

Sample:

vxuxinyimsft_0-1707360773799.png

 

Create a calculated column as follows

 

Column = CALCULATE(MAX('Table'[NAME]), FILTER('Table', [ID] < EARLIER('Table'[ID]) && [Category] = EARLIER('Table'[Category])))

 

 

vxuxinyimsft_1-1707360969514.png

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Community Support Team _Yuliax

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

SamInogic
Super User
Super User

Hi @Anonymous ,

Can you try below measure to get the difference?

Previous Value =
VAR CurrentValue = [YourCurrentMeasure]
VAR PreviousValue = CALCULATE ( [YourCurrentMeasure], PREVIOUSMONTH ( 'Date'[Date] ) // Use 'Date' as per your dataset structure )

RETURN CurrentValue - PreviousValue


Thanks!

Inogic Professional Services

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop and email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

 

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Drop an email at crm@inogic.com
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/
Ahmedx
Super User
Super User

could you share your pbix-file? Or create an example file which reproduces your issue?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.