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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
GunnerJ
Post Patron
Post Patron

repeat row value for new column based on filter date

I have a row counter for each row by account. What I'm hoping to do is repeat the max value across all rows as long as that rows date field is less than the date filter. The filter is in the "before" setting. 

 

This is what I currently have but it's just repeating the rows current value. I've also tried the allexcept with just the account in the filter.

MAX ROW = CALCULATE(MAX('MASTER CHARGE ACTIONS'[ROWRANK]),ALLEXCEPT('MASTER CHARGE ACTIONS','MASTER CHARGE ACTIONS'[BI_ACCT],'MASTER CHARGE ACTIONS'[ROWRANK]), FILTER('MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[CHG_DATE] <= MAX('Date Table'[Date])))

 

For reference here's a snapshot of one account along with a picture of the slicer. The date table is joined on the CHG_DATE column. The hope is in this example if the date filter is greater than or equal to April 23rd, 2019 to have ALL rows for the account show maxRow of 19 (blue). If the date slicer was on or after April 5th, 2019 but less than the 23rd I'd want all MaxRows to show 11 and so on.

dateslicer.PNG

rowRank.PNG

 

If anything else is needed please let me know and I'll be happy to provide more information.

Thanks in advance!

1 ACCEPTED SOLUTION

This works in your pbix file.

 

MAX ROW = VAR vMAXDATE = MAX('Date Table'[Date])
RETURN CALCULATE(
    CALCULATE(
        MAX('MASTER CHARGE ACTIONS'[ROWRANK]),
        FILTER('MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[CHG_DATE] <= vMAXDATE)
    ),
    ALLEXCEPT('MASTER CHARGE ACTIONS','MASTER CHARGE ACTIONS'[BI_ACCT]))

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur @daniel79 

 

Here you go! It's in the state shown in the last picture. 

https://www.dropbox.com/s/fgrcl590zb21xoh/OZARKSGO%202.0.pbix?dl=0

daniel79
Resolver II
Resolver II

Hi, can you try this?

 

MAX ROW = CALCULATE(
    CALCULATE(
        MAX('MASTER CHARGE ACTIONS'[ROWRANK]),
        FILTER('MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[CHG_DATE] <= MAX('Date Table'[Date]))
    ),
    ALLEXCEPT('MASTER CHARGE ACTIONS','MASTER CHARGE ACTIONS'[BI_ACCT]))

@daniel79 thanks for the reply!

our solution seems close but the value isn't updating as the date slider moves. It did get the max date across all rows though! In the picture below you can see the date slider only allows up to ROWRANK 9 which I'm hoping would take place of all of the 19s in MAX ROW. Any ideas on how to alter it to enable that functionality?

rowRank2.PNG

This works in your pbix file.

 

MAX ROW = VAR vMAXDATE = MAX('Date Table'[Date])
RETURN CALCULATE(
    CALCULATE(
        MAX('MASTER CHARGE ACTIONS'[ROWRANK]),
        FILTER('MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[CHG_DATE] <= vMAXDATE)
    ),
    ALLEXCEPT('MASTER CHARGE ACTIONS','MASTER CHARGE ACTIONS'[BI_ACCT]))

Thank you!

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.