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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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