Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
4 years ago
Solved

Measure to add Boolean values

Hello everyone

I have this case without finding a correct solution, I have two measures that add budget and shipping, I need to another extent meet a condition and add the total result

Calculations[Budget]>Calculations[Shipping],Calculations[Shipping],Calculations[Budget]
but I can't get the total sum of countable
MHR88_0-1651765510575.png

This is the code I have used.
countable =

IF(HASONEVALUE('Style by Make'[Assembly Style]),
Where P=
SWITCH(
True (),
Calculations[Budget]>Calculations[Shipping],Calculations[Shipping],
Calculations[Budget]
)
Return P

)
Someone who helps me with ideas, I will thank you eternally.
  • Syndicate_Admin 

    countable =
    
    SUMX(
    	VALUES('Style by Make'[Assembly Style]),
    	VAR _budget = Calculations[Budget]
    	VAR _shipping = Calculations[Shipping]
    	RETURN
    	IF ( _budget > _shipping, _shipping, _budget )
    )


    In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

6 Replies

  • SpartaBI's avatar
    SpartaBI
    Community Champion

    Syndicate_Admin 

    countable =
    
    SUMX(
    	VALUES('Style by Make'[Assembly Style]),
    	VAR _budget = Calculations[Budget]
    	VAR _shipping = Calculations[Shipping]
    	RETURN
    	IF ( _budget > _shipping, _shipping, _budget )
    )


    In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

      • SpartaBI's avatar
        SpartaBI
        Community Champion

        Syndicate_Admin my pleasure 🙂
        Please don't forget to mark that reply as a solution to help other community members find it more easily. Appreciate Your Kudos.

  • Hello, I hope you are well,

    in the model there is a calendar table, I want to show you the comparison of the result of the model vs calculated in excel, do you have any suggestions to modify the initial code?

    MHR88_0-1652812784105.png

    Greetings, thank you for your contribution.