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.
Dear Sir,
My query is to defined retailer class ( updated Retailer Class in trail mail) basis on the latest month of retailer transaction in power BI.
Please help to resolve this issue.
Retailer UID | Retailer Class | Month | Value | Updated Retailer Class | Remarks |
# | B | 01-06-2022 | 0.04771 | E | Based on latest month(Ex. 01-07-2022) |
# | E | 01-05-2022 | 0.03347 | E | Based on latest month(Ex. 01-07-2022) |
# | E | 01-06-2022 | 0.01668 | E | Based on latest month(Ex. 01-07-2022) |
# | E | 01-07-2022 | 0.00902 | E | Based on latest month(Ex. 01-07-2022) |
AP-0000001 | C | 01-05-2022 | 0.00229 | D | Based on latest month(Ex. 01-08-2022) |
AP-0000001 | D | 01-06-2022 | 0.00229 | D | Based on latest month(Ex. 01-08-2022) |
AP-0000001 | D | 01-08-2022 | 0.0048 | D | Based on latest month(Ex. 01-08-2022) |
AP-0000003 | C | 01-05-2022 | 0.00575 | D |
|
AP-0000003 | D | 01-06-2022 | 0.00574 | D |
|
AP-0000004 | C | 01-05-2022 | 0.0062 | B |
|
AP-0000004 | B | 01-06-2022 | 0.0056 | B |
|
AP-0000005 | D | 01-05-2022 | 0.00229 | A |
|
AP-0000005 | D | 01-06-2022 | 0.00699 | A |
|
AP-0000005 | A | 01-07-2022 | 0.00581 | A |
|
AP-0000006 | C | 01-05-2022 | 0.01172 | D |
|
AP-0000006 | D | 01-06-2022 | 0.00319 | D |
|
Solved! Go to Solution.
Hi @Anonymous ,
Please try this code to create a calculated column.
Updated Retailer Class Remarks =
VAR _LAST_MONTH =
CALCULATE (
MAX ( 'Table'[Month] ),
ALLEXCEPT ( 'Table', 'Table'[Retailer UID] )
)
RETURN
CALCULATE (
MAX ( 'Table'[Retailer Class] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Retailer UID] ),
'Table'[Month] = _LAST_MONTH
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thanks
Hi @Anonymous ,
Please try this code to create a calculated column.
Updated Retailer Class Remarks =
VAR _LAST_MONTH =
CALCULATE (
MAX ( 'Table'[Month] ),
ALLEXCEPT ( 'Table', 'Table'[Retailer UID] )
)
RETURN
CALCULATE (
MAX ( 'Table'[Retailer Class] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Retailer UID] ),
'Table'[Month] = _LAST_MONTH
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi,
when we use this in power pivot data modle it's showing error
how can we use in power pivot data model
Error is :
The function MAX takes an argument that evaluates to numbers or dates and cannot work with values of type String.
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 |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |