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.
I would like to return "Value2" by max date and by Category "Name"
and then return the respective value from column "Value1"
I also want to compare the Value2 column max date values and return
the non-similar values by the max date concept by category.
and then return the respective value from column "Value1"
The output should be like this
Name | DDMMYY | Value1 | Vaue2 |
A | 1/1/2023 | 5 | 2 |
A | 1/2/2023 | 5 | 2 |
A | 1/3/2023 | 5 | 2 |
A | 1/4/2023 | 6 | 3 |
A | 1/5/2023 | 8 | 5 |
A | 1/6/2023 | 8 | 6 |
A | 1/7/2023 | 8 | 6 |
B | 1/1/2023 | 7 | 3 |
B | 1/2/2023 | 7 | 3 |
B | 1/3/2023 | 7 | 3 |
B | 1/4/2023 | 8 | 4 |
B | 1/5/2023 | 10 | 6 |
B | 1/6/2023 | 10 | 7 |
B | 1/7/2023 | 10 | 7 |
Solved! Go to Solution.
Hi @ArpitVijay
It is nor very clear and the sample data might be a little misleading. Howeve, please refer to attached sample file with the proposed solution
Value X =
SUMX (
VALUES ( 'Table'[Name] ),
MAXX (
TOPN (
1,
CALCULATETABLE ( 'Table' ),
'Table'[DDMMYY]
),
'Table'[Value2]
)
)
Value Y =
SUMX (
VALUES ( 'Table'[Name] ),
MAXX (
TOPN (
1,
TOPN (
1,
CALCULATETABLE ( 'Table' ),
'Table'[Value1]
),
'Table'[DDMMYY],
ASC
),
'Table'[Value2]
)
)
Value1 is right however Value2 can't be calculated by top n I think.
Max date by category is 1.6.2023
and the "Value X" for Category a is 6 and category b is 4 colored in orange
now I would like to find the Value Y based on Max date by category and
the value should not equal to Previous Value "Value X"
Value1 is right however Value2 can't be calculated by top n I think.
Max date by category is 1.6.2023
and the "Value X" for Category a is 6 and category b is 4 colored in orange
now I would like to find the Value Y based on Max date by category and
the value should not equal to Previous Value "Value X"
May you please check I found your solution to be useful here.
@ArpitVijay- Please take a look at this DAX measure and let me know if it works for you. I'm uncertain if the results displayed by you are accurately calculated. Do let me know if there's something I might have overlooked.
VALUE X =
VAR MaxDate = CALCULATE(MAX('Table'[DDMMYY]), ALL('Table'))
VAR MaxValue2BeforeLastDate = CALCULATE(MAX('Table'[Vaue2]), 'Table'[DDMMYY] <> MaxDate)
RETURN MaxValue2BeforeLastDate
VALUE Y =
VAR MaxDate = CALCULATE(MAX('Table'[DDMMYY]), ALL('Table'))
VAR MaxValue1BeforeLastDate = CALCULATE(MAX('Table'[Value1]), 'Table'[DDMMYY] <> MaxDate)
RETURN MaxValue1BeforeLastDate
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 |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |