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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Syndicate_Admin
Administrator
Administrator

Value Calculation between relative dates

Hello community!

I need to use in my dashboard a comparison of time recorded by users and compare it with the previous month. For this, I chose to use the meter visual.

For informational purposes, the structure of the database is as follows.

UsersDatesValues
Usuario114/07/23110
Usuario128/06/23120
Usuario214/07/23130
Usuario207/07/23140
Usuario213/06/23150

Now, I have trouble generating a quick measure for this case. I need that, within the visual "Meter" the "Value" is the data of the current month, but the destination value is the sum of the column "Values" of the last month.

Does anyone have any idea how I can represent it correctly visually? Is it correct to use that visual to represent it?

I look forward to your comments,

Best regards.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Procito0o ,

 

You can try below measure to get the previous month value.

PreviousMonthValue = CALCULATE(SUM('Table'[Values]),FILTER(ALLSELECTED('Table'),[Users]=MAX('Table'[Users])),PREVIOUSMONTH('Table'[Dates]))

vstephenmsft_0-1691484246560.png

                                                                                                                                                         

Best Regards,

Stephen 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 @Procito0o ,

 

You can try below measure to get the previous month value.

PreviousMonthValue = CALCULATE(SUM('Table'[Values]),FILTER(ALLSELECTED('Table'),[Users]=MAX('Table'[Users])),PREVIOUSMONTH('Table'[Dates]))

vstephenmsft_0-1691484246560.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

 

AmiraBedh
Super User
Super User

Firstly, ensure that the "Dates" column is recognized as date type. If not, you will need to convert it. You can do this using the Power Query Editor, or by simply changing the data type in the Fields pane.

Then create a measure to get the sum of values for the current month:

Current Month Total =
CALCULATE(
SUM('Table'[Values]),
'Table'[Dates] >= EOMONTH(TODAY(), -1) + 1,
'Table'[Dates] <= EOMONTH(TODAY(), 0)
)


This measure will calculate the sum of "Values" for all dates within the current month.

Then create another measure to get the sum of values for the previous month:

 

Previous Month Total =
CALCULATE(
SUM('Table'[Values]),
'Table'[Dates] >= EOMONTH(TODAY(), -2) + 1,
'Table'[Dates] <= EOMONTH(TODAY(), -1)
)


This measure will calculate the sum of "Values" for all dates within the previous month.


- Put the "Current Month Total" measure in the "Value" field.
- Put the "Previous Month Total" measure in the "Target Value" field.

This will provide a comparison of the total value for the current month versus the previous month.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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