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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
shreya_gulati40
Regular Visitor

Table Dax Calculation

 

I have a table based on certain criteria, i need to use DAX 

 

1 ACCEPTED SOLUTION

you'll need to map the % Q1 or % Q2 to the corresponding tier based on the percentage range provided in your payout table and  evaluate the source (M1 or M2) and the number of units to apply the correct logic for determining if it meets the condition for >=20 units or <20 units.

 

 

Q1 Payout Calculation = 
VAR BaseSalary = SalesData[Base salary]
VAR Q1Units = SalesData[Q1 units]
VAR Source = SalesData[Source]
VAR PercentQ1 = SalesData[% Q1]
VAR InitialOrFollowon = IF(Q1Units >= 20, ">=20 units", "<20 units") // Simplified assumption
VAR TierBasedOnPercent =
    SWITCH(TRUE(),
        PercentQ1 <= 50, "Tier1",
        PercentQ1 > 50 && PercentQ1 <= 90, "Tier2",
        PercentQ1 > 90, "Tier3",
        "Tier1" // Default case if no match
    )
VAR TierAdjustedForQuarter = 
    SWITCH(TierBasedOnPercent,
        "Tier3", "Tier2",
        "Tier2", "Tier1",
        "Tier1", "Tier1" // No tier below Tier1
    )
VAR PayoutPercentage =
    SWITCH(TRUE(),
        AND(Source = "M1", InitialOrFollowon = ">=20 units", TierAdjustedForQuarter = "Tier1"), 0.1,
        AND(Source = "M1", InitialOrFollowon = "<20 units", TierAdjustedForQuarter = "Tier1"), 0.05,
        AND(Source = "M2", InitialOrFollowon = ">=5 units", TierAdjustedForQuarter = "Tier1"), 0.1, // Assuming similar logic for M2
        // Add additional conditions for each combination of Source, InitialOrFollowon, and TierAdjustedForQuarter
        0 // Default case if none above match
    )
RETURN
BaseSalary * PayoutPercentage

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

3 REPLIES 3
AmiraBedh
Super User
Super User

Try the following : 

 

Q1 Payout = 
VAR BaseSalary = SalesData[Base salary]
VAR Q1Units = SalesData[Q1 units]
VAR OrderType = SalesData[Order Type]
VAR Tier =
    SWITCH(TRUE(),
        Q1Units >= 20, "Tier3",
        Q1Units >= 5, "Tier2",
        "Tier1"
    )
VAR TierAdjusted =
    SWITCH(Tier,
        "Tier3", "Tier2",
        "Tier2", "Tier1",
        "Tier1", "Tier1" // No tier below Tier1
    )
VAR PayoutPercentage =
    SWITCH(TRUE(),
        AND(TierAdjusted = "Tier1", OrderType = "Initial"), 0.1,
        AND(TierAdjusted = "Tier1", OrderType = "Followon"), 0.05,
        AND(TierAdjusted = "Tier2", OrderType = "Initial"), 0.2,
        AND(TierAdjusted = "Tier2", OrderType = "Followon"), 0.1,
        AND(TierAdjusted = "Tier3", OrderType = "Initial"), 0.3,
        AND(TierAdjusted = "Tier3", OrderType = "Followon"), 0.2,
        0 // Default case if none above match
    )
RETURN
BaseSalary * PayoutPercentage

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

O

 

you'll need to map the % Q1 or % Q2 to the corresponding tier based on the percentage range provided in your payout table and  evaluate the source (M1 or M2) and the number of units to apply the correct logic for determining if it meets the condition for >=20 units or <20 units.

 

 

Q1 Payout Calculation = 
VAR BaseSalary = SalesData[Base salary]
VAR Q1Units = SalesData[Q1 units]
VAR Source = SalesData[Source]
VAR PercentQ1 = SalesData[% Q1]
VAR InitialOrFollowon = IF(Q1Units >= 20, ">=20 units", "<20 units") // Simplified assumption
VAR TierBasedOnPercent =
    SWITCH(TRUE(),
        PercentQ1 <= 50, "Tier1",
        PercentQ1 > 50 && PercentQ1 <= 90, "Tier2",
        PercentQ1 > 90, "Tier3",
        "Tier1" // Default case if no match
    )
VAR TierAdjustedForQuarter = 
    SWITCH(TierBasedOnPercent,
        "Tier3", "Tier2",
        "Tier2", "Tier1",
        "Tier1", "Tier1" // No tier below Tier1
    )
VAR PayoutPercentage =
    SWITCH(TRUE(),
        AND(Source = "M1", InitialOrFollowon = ">=20 units", TierAdjustedForQuarter = "Tier1"), 0.1,
        AND(Source = "M1", InitialOrFollowon = "<20 units", TierAdjustedForQuarter = "Tier1"), 0.05,
        AND(Source = "M2", InitialOrFollowon = ">=5 units", TierAdjustedForQuarter = "Tier1"), 0.1, // Assuming similar logic for M2
        // Add additional conditions for each combination of Source, InitialOrFollowon, and TierAdjustedForQuarter
        0 // Default case if none above match
    )
RETURN
BaseSalary * PayoutPercentage

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.