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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Converting DAX to M, please help me about this

=
IF (
    order_details[PRODUCT_CATEGORY]  = "Trial",
    0,
    IF (
      order_details[PRODUCT_CATEGORY]  = "Trial Completion",
        1,
        IF (
            order_details[PRODUCT_CATEGORY] <> "Rebill",
            -5,
           
                RANKX (
                    FILTER (
                        order_details,
                        order_details[Unique_Key] = EARLIER ( order_details[Unique_Key] )
                            && RELATED ( products[PRODUCT_CATEGORY] ) = "Rebill"
                            && order_details[ORDER_STATUS] <> "DECLINED"
                            && order_details[IS_TEST_ACTUAL] = "N"
                    ),
                    order_details[order_id],
                    ,
                    ASC
                ) + 1,
                
            )
        )
    )
)

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

For now, your dax formula involves two or more tables. In powerbi M query, you will most likely need to create a new query to associate the two tables(order_details and products). It is recommended to provide sample data for further research.

Best Regards,
Community Support Team _ Eason

Anonymous
Not applicable

Hi,

 

lets say, this is from one table.

 

=
IF (
    order_details[PRODUCT_CATEGORY]  = "Trial",
    0,
    IF (
      order_details[PRODUCT_CATEGORY]  = "Trial Completion",
        1,
        IF (
            order_details[PRODUCT_CATEGORY] <> "Rebill",
            -5,
           
                RANKX (
                    FILTER (
                        order_details,
                        order_details[Unique_Key] = EARLIER ( order_details[Unique_Key] )
                            && order_details[PRODUCT_CATEGORY]  = "Rebill"
                            && order_details[ORDER_STATUS] <> "DECLINED"
                            && order_details[IS_TEST_ACTUAL] = "N"
                    ),
                    order_details[order_id],
                    ,
                    ASC
                ) + 1,
                
            )
        )
    )
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors