Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
Anonymous
Not applicable

Required DAX Formula

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

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

RicoZhou_0-1657765395264.png

 

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.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

thanks

Anonymous
Not applicable

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.

RicoZhou_0-1657765395264.png

 

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.

 

Anonymous
Not applicable

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.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.