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
davinci_cat
Frequent Visitor

Creating a measure to take MAX based on existing columns

Hi

 

I have a dashboard with data in the following format:

 

There is a number of accounts in the same table and for each account there are multiple monthly rows of data. There is a column called PnL. I have created a measure that calculates the percent change between one month and the next for each account, let's call it PnL Monthly Change.  I would like to create a measure that can look at PnL Monthly Change for each account, for the latest month only and give me only the MAX value from all of them. The idea is that if it reaches a certain threshold, an email notification is issued. 

Now, I've struggled with this because I cannot treat the PnL measure as a column. I can't create a calculated column for PnL change because (I think) there are multiple accounts in the same table. Maybe I am thinking about this in a wrong way and there is a simpler solution.

 

In the end, I would like to create a measure that only looks at the latest month, at all accounts, calculates the Monthly PnL Change for each account and then shows me the MAX value. TIA.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @davinci_cat ,

You can try this DAX:

Max PnL Monthly Change for Latest Month = 
CALCULATE(
    MAXX(
        ALL('Accounts'), // Replace with your actual accounts table name
        [PnL Monthly Change]
    ),
    FILTER(
        ALL('Date'),
        'Date'[Date].[MonthNo] =  = MONTH(TODAY() - DATEDIFF("2023-01-01","2023-02-02",DAY))
    )
)

Best Regards,

Xianda Tang

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 @davinci_cat ,

You can try this DAX:

Max PnL Monthly Change for Latest Month = 
CALCULATE(
    MAXX(
        ALL('Accounts'), // Replace with your actual accounts table name
        [PnL Monthly Change]
    ),
    FILTER(
        ALL('Date'),
        'Date'[Date].[MonthNo] =  = MONTH(TODAY() - DATEDIFF("2023-01-01","2023-02-02",DAY))
    )
)

Best Regards,

Xianda Tang

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

vanessafvg
Super User
Super User

please provide sample data with an example of your expected solution.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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