Forum Discussion

Strongbuck's avatar
Strongbuck
Helper I
2 years ago
Solved

Need Help with DAX for Multiple Columns with Multiple Equations

I am trying to calculate a number using a formula.  Depending on what value is in the Description column, I want to multiple it by a different number.  I can get one statement to work but it does not...
  • AlexisOlson's avatar
    2 years ago

    Try a measure like this:

    Base Wood =
    SUMX (
        'All_Projects',
        'All_Projects'[Apr 24]
            * SWITCH (
                'All_Projects'[Description],
                "High Use Lawn Soil",    0.40,
                "Plant Bed Soil",        0.50,
                "Horticultural Subsoil", 0.67
            )
    )

     

    You should really unpivot your data table so that different dates are not separate columns. See here:
    https://learn.microsoft.com/en-us/power-query/unpivot-column