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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
rachaelwalker
Resolver III
Resolver III

Switch Statement to multiply different measures based on category name

I am trying to create a DAX measure to calculate the Revenue Forecast based on the age of opportunities. Each age category has a different conversion rate based on historical rates. I placed the DAX below in a calculated column and it comes through in a card visual but not on the table which is where I need it. I have tried both IF and SWITCH statements. I think I need it to be a measure but the measure is not seeing my Age Category column. 

 

Revenue Forecast = SWITCH(
TRUE,
'Opportunity'[Age Category] = "0-90 Days", ([TotalRevenue] * [90DayRateWon] * [Conversion Rate R12M]),
'Opportunity'[Age Category] = "90-180 Days", ([TotalRevenue] * [180DayRateWon] * [Conversion Rate R12M]),
'Opportunity'[Age Category] = "180-270 Days", ([TotalRevenue] * [270DayRateWon] * [Conversion Rate R12M]),
0) 

 

rachaelwalker_0-1708624726982.png

For the first category 0-90 Days, I want it to take $260,573.54 X [90DayRateWon] X [Conversion Rate R12M] etc...Thank you for taking the time.

 

1 ACCEPTED SOLUTION
rachaelwalker
Resolver III
Resolver III

I finally got it working using a measure with variables. 

 

Revenue Forecast Measure =
VAR AgeCategory = SELECTEDVALUE('Opportunity'[Age Category])
VAR Conversion = [Conversion Rate R12M]
RETURN
IF(
    ISBLANK(AgeCategory),
    BLANK(),
    SWITCH(
        TRUE(),
        AgeCategory = "0-90 Days", [TotalRevenue] * [90DayRateWon] * Conversion,
        AgeCategory = "90-180 Days", [TotalRevenue] * [180DayRateWon] * Conversion,
        AgeCategory = "180-270 Days", [TotalRevenue] * [270DayRateWon] * Conversion,
        AgeCategory = "270+ Days", [TotalRevenue] * [270+DayRateWon] * Conversion, 0
    )
)

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@rachaelwalker 

Please try:

Revenue Forecast Measure =
SUMX (
    'Opportunity',
    SWITCH (
        TRUE (),
        'Opportunity'[Age Category] = "0-90 Days", [TotalRevenue] * [90DayRateWon] * [Conversion Rate R12M],
        'Opportunity'[Age Category] = "90-180 Days", [TotalRevenue] * [180DayRateWon] * [Conversion Rate R12M],
        'Opportunity'[Age Category] = "180-270 Days", [TotalRevenue] * [270DayRateWon] * [Conversion Rate R12M],
        0
    )
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

rachaelwalker
Resolver III
Resolver III

I finally got it working using a measure with variables. 

 

Revenue Forecast Measure =
VAR AgeCategory = SELECTEDVALUE('Opportunity'[Age Category])
VAR Conversion = [Conversion Rate R12M]
RETURN
IF(
    ISBLANK(AgeCategory),
    BLANK(),
    SWITCH(
        TRUE(),
        AgeCategory = "0-90 Days", [TotalRevenue] * [90DayRateWon] * Conversion,
        AgeCategory = "90-180 Days", [TotalRevenue] * [180DayRateWon] * Conversion,
        AgeCategory = "180-270 Days", [TotalRevenue] * [270DayRateWon] * Conversion,
        AgeCategory = "270+ Days", [TotalRevenue] * [270+DayRateWon] * Conversion, 0
    )
)

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.