Forum Discussion
Anonymous
6 years agoNot applicable
Filter value based on multiple criteria
Hi, Can you please help me filter value of the last year for each company in the table below? The result in the last column should be 4 for company A, 200 for company C, and 4 for company B. I ...
- 6 years ago
Hi Anonymous ,
Measure way:
Measure = VAR maxyear = CALCULATE ( MAX ( 'Table'[Year] ), ALLEXCEPT ( 'Table', 'Table'[Company] ) ) RETURN CALCULATE ( MAX ( 'Table'[Value] ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[Company] ), 'Table'[Year] = maxyear ) )Alternatively,to use a calculated column as below.
in the final year = VAR maxyear = CALCULATE ( MAX ( 'Table'[Year] ), FILTER ( 'Table', 'Table'[Company] = EARLIER ( 'Table'[Company] ) ) ) RETURN CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Year] = maxyear && 'Table'[Company] = EARLIER ( 'Table'[Company] ) ) )Pbix as attached.
az38
6 years agoCommunity Champion
Sorry Anonymous
it must be comma
Value in the final year=
var _lastYear = calculate(max('Table'[Year]),ALLEXCEPT('Table','Table'[Company]))
RETURN
LOOKUPVALUE('Table'[Value], 'Table'[Company],SELECTEDVALUE('Table'[Company]), 'Table'[Year],_lastYear)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Anonymous
6 years agoNot applicable
Hi,
Thanks for your quick reply.
The error is gone but the column now has no value in it.
Is it because PowerBI do not understand which ticker we are selecting?
FYI, The result will be used as an input for another calculation.
Thanks for your quick reply.
The error is gone but the column now has no value in it.
Is it because PowerBI do not understand which ticker we are selecting?
FYI, The result will be used as an input for another calculation.
- az386 years agoCommunity Champion
Anonymous
where do yo try to see the result?
table visual based on your data sample
do not hesitate to give a kudo to useful posts and mark solutions as solution
- Anonymous6 years agoNot applicable
I added as a column for my current table