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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.