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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
dudeeee
Frequent Visitor

show date and other column values of rows with min and max date in separate cards

DatevalueAvalueB
2022-09-129
 33
2022-08-2356
2022-09-1969
2022-09-1787

Hello , I am new to power bi and been stuck with this problem for a while. From above sample table I want to get the values of date, valueA and valueB for maximum and minimum date excluding the empty date.

I want to display the data from two rows in separate card visuals. I want it to work after application of other filters/slicers as well. 

1 ACCEPTED SOLUTION

@dudeeee 

Please try

Card A Max =
VAR T1 =
ADDCOLUMNS (
FILTER ( VALUES ( 'Table'[Date] ), 'Table'[Date] <> BLANK () ),
"@Value", CALCULATE ( SUM ( [Value A] ) )
)
VAR T2 =
TOPN ( 1, T1, [@Value], DESC )
VAR MaxValueDate =
MAXX ( T2, 'Table'[Date] )
VAR T3 =
FILTER ( 'Table', 'Table'[Date] = MaxValueDate )
RETURN
CONCATENATEX ( T3, [Date] & UNICHAR ( 10 ) & [@Value], UNICHAR ( 10 ) )

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

@dudeeee 

Please try

Card A Max =
VAR T1 =
ADDCOLUMNS (
FILTER ( VALUES ( 'Table'[Date] ), 'Table'[Date] <> BLANK () ),
"@Value", CALCULATE ( SUM ( [Value A] ) )
)
VAR T2 =
TOPN ( 1, T1, [@Value], DESC )
VAR MaxValueDate =
MAXX ( T2, 'Table'[Date] )
VAR T3 =
FILTER ( 'Table', 'Table'[Date] = MaxValueDate )
RETURN
CONCATENATEX ( T3, [Date] & UNICHAR ( 10 ) & [@Value], UNICHAR ( 10 ) )

dudeeee
Frequent Visitor

@tamerj1 

valueA and valueB are columns from the source table

@dudeeee 
Here is same but fixed some errors

Card A Max =
VAR T1 =
    ADDCOLUMNS (
        FILTER ( VALUES ( 'Table'[Date] ), 'Table'[Date] <> BLANK () ),
        "@Value", CALCULATE ( SUM ( [Value A] ) )
    )
VAR T2 =
    TOPN ( 1, T1, [@Value], DESC )
RETURN
    CONCATENATEX (
        T2,
        [Date] & UNICHAR ( 10 ) & [@Value],
        UNICHAR ( 10 ),
        [Date], ASC
    )
Card A Min =
VAR T1 =
    ADDCOLUMNS (
        FILTER ( VALUES ( 'Table'[Date] ), 'Table'[Date] <> BLANK () ),
        "@Value", CALCULATE ( SUM ( [Value A] ) )
    )
VAR T2 =
    TOPN ( 1, T1, [@Value], ASC)
RETURN
    CONCATENATEX (
        T2,
        [Date] & UNICHAR ( 10 ) & [@Value],
        UNICHAR ( 10 ),
        [Date], ASC
    )

hello, @tamerj1 I think I am near to the solution.

Is it possible to get only the value but not its sum returned.

DatevalueAvalueB
2022-09-129
 33
2022-08-2356
2022-09-1969
2022-09-1787

I just want to get result as:

     Min                     Max

2022-08-23        2022-09-19

5                                 6

6                                 9

And show them in separate cards.

 

@dudeeee 

Please try

Card A Max =
VAR T1 =
ADDCOLUMNS (
FILTER ( VALUES ( 'Table'[Date] ), 'Table'[Date] <> BLANK () ),
"@Value", CALCULATE ( SUM ( [Value A] ) )
)
VAR T2 =
TOPN ( 1, T1, [@Value], DESC )
VAR MaxValueDate =
MAXX ( T2, 'Table'[Date] )
VAR T3 =
FILTER ( 'Table', 'Table'[Date] = MaxValueDate )
RETURN
CONCATENATEX ( T3, [Date] & UNICHAR ( 10 ) & [@Value], UNICHAR ( 10 ) )

tamerj1
Super User
Super User

Hi @dudeeee 

Are Value A and Value B measures or columns in the source data table?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.