Forum Discussion

chall069's avatar
chall069
Frequent Visitor
6 years ago
Solved

Need formula to return certain values for different size objects

I am working to create a score card for a category. I do not know if what I am trying to do is possible.

 

I would like to create a dax function that compares all the text values (Size) within a group (Environment). If the text values are not the same within a given group then it should return a 0 for the record; if they are the same within a given group then return a 1.

 

See the below table for what the result should look like. Thank you for the assistance!

 

EnvironmentSizeReturn Value
DevelopmentStandard_B4ms0
DevelopmentStandard_B8ms0
ProductionStandard_DS3_v20
ProductionStandard_DS4_v20
QAStandard_DS3_v21
QAStandard_DS3_v21
StageStandard_DS3_v21
StageStandard_DS3_v21
UATStandard_DS3_v20
UATStandard_DS4_v20
  • chall069 add following measure and that will do it

     

    Measure = 
    VAR __c =  CALCULATETABLE ( VALUES ( 'Table (2)'[Size] ), ALLEXCEPT ( 'Table (2)', 'Table (2)'[Environment] ) )
    RETURN
    IF ( COUNTROWS ( __c ) > 1, 0, 1 ) 

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

3 Replies

  • nandic's avatar
    nandic
    Resident Rockstar

    chall069 ,
    Here is the formula:

    Return Value =
    IF(
      CALCULATE(
         DISTINCTCOUNT(Sheet1[Size]),
         ALLEXCEPT(Sheet1,Sheet1[Environment]))>1,
         0,1
    )



  • chall069 add following measure and that will do it

     

    Measure = 
    VAR __c =  CALCULATETABLE ( VALUES ( 'Table (2)'[Size] ), ALLEXCEPT ( 'Table (2)', 'Table (2)'[Environment] ) )
    RETURN
    IF ( COUNTROWS ( __c ) > 1, 0, 1 ) 

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.