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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Jorritster
Frequent Visitor

Measure that displays month when value for column X changed

Hi all,

 

I am trying to create a seemingly easy measure in Power Bi.  I have a year, month and a binary variable called Threshold_Passed. I  want to create a measure that contains the month in which the Threshold_Passed measure changed from False to True, because only in that month I need to check it. If it is True again in April, I can assume it has already been checked last month.

 

It can also happen that in the first month of the year the Threshold_Passed measure is already True. In that case the Month_Threshold_Passed should be January. Once the Threshold_Passed variable has a True, it can never go back to false within the same year.

 

YearMonthThreshold_PassedMonth_Threshold_Passed
2022JanuaryFalse 
2022FebruaryFalse 
2022MarchTrueMarch
2022AprilTrueMarch

 

Any help is appreciated. Let me know if you need any more information.

 

Kind regards, Jorrit

 

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

Hi @Jorritster ,

According to your description, I download your sample, here's my solution.

Create a measure,

Month_Threshold_Passed =
VAR _MIN =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) )
                && 'Table'[Threshold_Passed] = "True"
        ),
        'Table'[Date]
    )
RETURN
    IF (
        MONTH ( MAX ( 'Table'[Date] ) ) < MONTH ( _MIN )
            || NOT ( ISINSCOPE ( 'Table'[Customer] ) ),
        BLANK (),
        FORMAT ( _MIN, "MMMM" )
    )

Get the result.

vkalyjmsft_0-1655864578535.png

I attach my sample for reference.

 

Best Regards,
Community Support Team _ kalyj

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

5 REPLIES 5
v-yanjiang-msft
Community Support
Community Support

Hi @Jorritster ,

According to your description, I download your sample, here's my solution.

Create a measure,

Month_Threshold_Passed =
VAR _MIN =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) )
                && 'Table'[Threshold_Passed] = "True"
        ),
        'Table'[Date]
    )
RETURN
    IF (
        MONTH ( MAX ( 'Table'[Date] ) ) < MONTH ( _MIN )
            || NOT ( ISINSCOPE ( 'Table'[Customer] ) ),
        BLANK (),
        FORMAT ( _MIN, "MMMM" )
    )

Get the result.

vkalyjmsft_0-1655864578535.png

I attach my sample for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

Hi @v-yanjiang-msft, one additional question. Ideally, for my dashboard I want the user to be able to filter with a slicer on the Month_Threshold_Passed. After Googling I found out that I need to create a column for this. However, if I use the same code it does not understand the relationships. This is my model:

 

Jorritster_0-1656316307801.png

How can I include related(table) in the code to make it work for a column? I have a bridge direction table because otherwise I have a many-to-many relationship. 

 

Hope you can help 🙂

 

 

Hi @v-yanjiang-msft,

 

Your a hero. Thanks for your help. 🙂

 

I have accepted your post as a solution. Cheers!

lbendlin
Super User
Super User

You can use MIN() or FIRSTNONBLANK() or many other approaches for this.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hi Ibendlin,

 

Thank you for your response. 

 

As the data is confidential I did not add it initially. However, I have created some dummy data based on manual entry that covers an example. I have not included the model as I am using a lot of different sources:

https://www.dropbox.com/s/sxt9vju0xkhbn5t/Dummy_Threshold_Management.pbix?dl=0

 

To give you some more perspective (in the actual model): 

- YTD_TaxableBasis is a YTD calculation of Monthly TaxableBasis.

- Threshold is coming from a different table (each country has a different threshold).

- Threshold_Passed equals True if YTD_TaxableBasis > Threshold.

 

Goal: create an indicator (Month_Threshold_Passed) to know when the threshold was passed. 

 

Expected output:

Jorritster_0-1655711995468.png

 

Hope this helps, Jorrit

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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