Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
Date | valueA | valueB |
2022-09-1 | 2 | 9 |
3 | 3 | |
2022-08-23 | 5 | 6 |
2022-09-19 | 6 | 9 |
2022-09-17 | 8 | 7 |
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.
Solved! Go to Solution.
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 ) )
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
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.
Date | valueA | valueB |
2022-09-1 | 2 | 9 |
3 | 3 | |
2022-08-23 | 5 | 6 |
2022-09-19 | 6 | 9 |
2022-09-17 | 8 | 7 |
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.
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 ) )
Hi @dudeeee
Are Value A and Value B measures or columns in the source data table?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
10 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |