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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
karinafreitass
Helper III
Helper III

Last month measure

Hello Guys, how are you?

Could someone help me find a solution for the following:

I have the following relationship between tables below

Screenshot (101)_LI.jpg

in table:

Screenshot (99)_LI.jpg

The calculated "MRR fim do mes" column is a measure of cumulative total.

From there, how could I get a measure that would give me the MRR value of the past month?

 

Thanks so much

 

Karina

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

Hi @karinafreitass ,

 

I made a simple sample.

First of all, there can be no relationship between the two tables. If it is relevant, the value of the previous month cannot be obtained.

 

Measure =
IF (
    CALCULATE (
        MAX ( 'Table'[Data] ),
        FILTER (
            ALL ( 'Table' ),
            [Data]
                = DATESINPERIOD (
                    'dCalendar'[Data],
                    SELECTEDVALUE ( dCalendar[Data] ),
                    -1,
                    MONTH
                )
        )
    )
        = MAX ( 'Table'[Data] ),
    1
)

 

 

Then put the measure into visual level Filters and set Show items when the value is 1.

Screenshot 2021-04-28 151510.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

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @karinafreitass ,

 

I made a simple sample.

First of all, there can be no relationship between the two tables. If it is relevant, the value of the previous month cannot be obtained.

 

Measure =
IF (
    CALCULATE (
        MAX ( 'Table'[Data] ),
        FILTER (
            ALL ( 'Table' ),
            [Data]
                = DATESINPERIOD (
                    'dCalendar'[Data],
                    SELECTEDVALUE ( dCalendar[Data] ),
                    -1,
                    MONTH
                )
        )
    )
        = MAX ( 'Table'[Data] ),
    1
)

 

 

Then put the measure into visual level Filters and set Show items when the value is 1.

Screenshot 2021-04-28 151510.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.

amitchandak
Super User
Super User

@karinafreitass , why the date table is on the many side in this case. It should be on one side. Check and correct the join.

With help time intelligence and date table, you can have

example

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak Thank you very much for your answer.

I adjusted the relation between the tables.

I created an image that better replicates what I want as a result

imagem.png

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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