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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Pepe1989
New Member

Max overall date in columns

Hi everyone,

 

I'm strugeling to create a measure which will show max date selected by slicer excluding row context filter.

e.g. Last Trade Date

 

I have a reporting date dimension including Date, MonthEndDate, Year, Quarter...

And a Transactions fact with numerous measures and foreign key to Date dimension.

Data Mode:

Pepe1989_1-1637139938173.png

 

 

What i would like to see is below example. So based on date slicer show last trade date in all rows.

Pepe1989_0-1637139676031.png

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Pepe1989 ,

You can create a measure as below, please find the details in the attachment.

Last Trade Date = 
VAR _sumofamount =
    SUM ( 'Transactions'[Amount] )
VAR _maxdate =
    CALCULATE (
        MAX ( 'Transactions'[ReportingDateFK] ),
        FILTER (
            ALLSELECTED ( 'Transactions' ),
            'Transactions'[ReportingDateFK] >= MIN ( 'Reporting Date'[Date] )
                && 'Transactions'[ReportingDateFK] <= MAX ( 'Reporting Date'[Date] )
        )
    )
RETURN
    IF ( ISBLANK ( _sumofamount ), BLANK (), _maxdate )

yingyinr_0-1637747872602.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Pepe1989 ,

You can create a measure as below, please find the details in the attachment.

Last Trade Date = 
VAR _sumofamount =
    SUM ( 'Transactions'[Amount] )
VAR _maxdate =
    CALCULATE (
        MAX ( 'Transactions'[ReportingDateFK] ),
        FILTER (
            ALLSELECTED ( 'Transactions' ),
            'Transactions'[ReportingDateFK] >= MIN ( 'Reporting Date'[Date] )
                && 'Transactions'[ReportingDateFK] <= MAX ( 'Reporting Date'[Date] )
        )
    )
RETURN
    IF ( ISBLANK ( _sumofamount ), BLANK (), _maxdate )

yingyinr_0-1637747872602.png

Best Regards

amitchandak
Super User
Super User

@Pepe1989 , Try a measure like

maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])

 

or maxx(ALLSELECTED('Table'), 'Table'[Date]) 

 

of we can find

 

Max Date  =
var _min = minx(ALLSELECTED('Date'), 'Date'[Date])
var _max = maxx(ALLSELECTED('Date'), 'Date'[Date])
return
CALCULATE(Max(Table[Date]) ,filter(all('Date'), 'Date'[Date] >=_min && 'Date'[Date] <= _max ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

Unfortunately, because I wanted to simplify model as much as possible, I didn’t list other dimensions link to that fact table.

 

Now, with your code I’m getting max date but only by other dimensions.
full data model is presented below:

Pepe1989_0-1637142422442.png

 

Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors