Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |