Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Unable to create a new column by using 2 measures(calculated)

Hi,

 

If statement is not working for decimal numbers.
Example:

Excepted PriceActual PriceOutput as Validated Coming from Switch
100.25101.45Needs ReviewValidated 
35.7624.54Validated Validated
45.6525.43ValidatedValidated
 0.00Not ChargedValidated
95.45100.25Needs ReviewValidated
 0.00Not ChargedValidated


I want to create a colume as validation status colume.by using Switch statement,Actual Price & Expected Price are calculated Measure.

Switch satement 

Validation Status = SWITCH (
TRUE (),
[Actual Price]>[Expected Price],"Needs Review",
[Actual Price]=0,"Not Charged",
[Actual Price]<=[Expected Price],"Validated"
)

Please help me 

4 Replies

  • Anonymous , check the datatype of the column. Tray a new column like

     

    Validation Status = SWITCH (
    TRUE (),
    [Actual Price]=0,"Not Charged",
    [Actual Price]*1.0>[Expected Price]*1.0,"Needs Review",
    [Actual Price]*1.0<=[Expected Price]*1.0,"Validated"
    )

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous - Would need to see the formulas for your measures as well as sample source data. I mocked up what you gave us. See attached PBIX file Table (9), Page (9). Seems to work but who knows what is really going on with your data and measure calculations.

     

    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      Thanks for your response, i want that as a colume.

      Thanks & Regards,

      Sriram.K

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        I just try to reproduce your problem, but it can get the correct status(see below screen shot)...Could you please provide some sample data which involve in your visuals with screen and the formula of measure "Excepted Price" and "Actual Price" in order to make troubleshooting and provide a proper solution? In addition, confirm with you that you want to create a calculated column rather than a measure to obtain the validation status, right?

        Best Regards

        Rena