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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Subtraction two vales

Hi

 

I would like to show a measure based on end of the month’s value from one table minus today's value in another

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Here is my sample data (Today is 2024.7.24):

vjunyantmsft_0-1721782148033.png

vjunyantmsft_1-1721782154059.png

Use this DAX to create a measure:

Difference = 
VAR _PreviousMonthEndDay = EOMONTH(TODAY(), -1)
VAR _PreviousMonthValue = 
CALCULATE(
    SUM('Table (2)'[Value]),
    'Table (2)'[Date] = _PreviousMonthEndDay
)
VAR _TodayValue = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = TODAY()
)
RETURN
_PreviousMonthValue - _TodayValue

And the final output is as below:

vjunyantmsft_2-1721782202898.png


Best Regards,
Dino Tao
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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Here is my sample data (Today is 2024.7.24):

vjunyantmsft_0-1721782148033.png

vjunyantmsft_1-1721782154059.png

Use this DAX to create a measure:

Difference = 
VAR _PreviousMonthEndDay = EOMONTH(TODAY(), -1)
VAR _PreviousMonthValue = 
CALCULATE(
    SUM('Table (2)'[Value]),
    'Table (2)'[Date] = _PreviousMonthEndDay
)
VAR _TodayValue = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = TODAY()
)
RETURN
_PreviousMonthValue - _TodayValue

And the final output is as below:

vjunyantmsft_2-1721782202898.png


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

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Do you want a MEASURE?  Measures are written in DAX, this is the Power Query forum and PQ uses the M language, not DAX.  PQ does not create measures.

 

Please provide some sample data (in a file, not an image) and an example of the desired result.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.