Reply
Circuscazz
Helper I
Helper I
Partially syndicated - Outbound

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

Syndicated - Outbound

Hi @Circuscazz ,

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

Syndicated - Outbound

Hi @Circuscazz ,

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

Syndicated - Outbound

Hi @Circuscazz 

 

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!


avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)