Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Team,
Need to find the MAX value for a year based on the Criteria. In the below table, we have values for COuntry & Brand combincation appearing for each QTR, need to find the MAX QTR for 2023 and likewise for 2024. Highlighted Calculated Column is what I need.
If Italy Ferrari has 3 QTR, 1, 2 & 3 then against Q3 2023, it should put 2023, likewise for 2024.
Thanks!
Solved! Go to Solution.
Thanks for the response.
Managed to crack it on my own, did it slighltly differently
Var MaxQTR_Year =
If( MAX ( Table[QuarterYear] ) =
Calculate(
MAX ( Table[QuarterYear] ),
Allexcept(Table, Table[Country], Table[Brand], Table[QuarterYear]),
Right(Table[QuarterYear],4),
Blank()
)
Return MaxQTR_Year
Thanks for the response.
Managed to crack it on my own, did it slighltly differently
Var MaxQTR_Year =
If( MAX ( Table[QuarterYear] ) =
Calculate(
MAX ( Table[QuarterYear] ),
Allexcept(Table, Table[Country], Table[Brand], Table[QuarterYear]),
Right(Table[QuarterYear],4),
Blank()
)
Return MaxQTR_Year
Hi @AlwaysAGooner,
Can you try the below formula in a measure?
This assumes you have QuarterYear like you have in the question and Calendar Year as well. Replace 'Table' with your table name.
Explanation: We get the QuarterYear for the corresponding row and then we have a summarized table that contains the max quarter for each year. We filter that table with current row's QuarterYear and then check the count. If it is 1, we use the corresponding year value or else Blank.
YearOnMaxQ =
VAR __CurrentRow =
MAX ( Table[QuarterYear] )
VAR __CheckIfMaxQ =
FILTER (
SUMMARIZE (
ALL ( Table ),
Table[Year],
"MaxQuarter", MAX ( Table[QuarterYear] )
),
[MaxQuarter] = __CurrentRow
)
VAR __CorrespYear =
MAXX ( __CheckIfMaxQ, [Year] )
VAR __FinalYear =
IF ( COUNTROWS ( __CheckIfMaxQ ) = 1, __CorrespYear, BLANK () )
RETURN
__FinalYear
Tested:
Upvote and accept as solution if it helps!
User | Count |
---|---|
57 | |
21 | |
21 | |
19 | |
16 |
User | Count |
---|---|
86 | |
84 | |
52 | |
37 | |
23 |