Forum Discussion

rdallimore's avatar
rdallimore
Frequent Visitor
8 years ago
Solved

Measure with conditions

Hi good people of the community!,

 

im looking to create a set of measures for my data set so i can capture trend on an ongoing basises inanother table - but im having a little trouble with the measures - effectivly what i want to achieve is:

 

NewMeasure = DISTINCTCOUNT(from this table[of these things]) WHERE (this table[this column]) value is Equal to "x"

 

am i right in thinking i should wrap everything in a CALCULATE(DISTINCTCOUNT(table&row),CALCUCLATE(SUM(table&row),condition))

 

any help applreciated

 

Rich

 

  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi rdallimore

     

    Yes, based on the high level details you have given in the post, yes, you can use CALCULATE function with the DISTINCTCOUNT or SUM along with FILTER() as needed. For example:

    CALCULATE(DISTINCTCOUNT(Sales[Order ID]), FILTER(Sales,Sales[Product ID]=100))

     

    Post more details with sample data if you need exact solution.

     

    Thanks

    Raj

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rdallimore

     

    Yes, based on the high level details you have given in the post, yes, you can use CALCULATE function with the DISTINCTCOUNT or SUM along with FILTER() as needed. For example:

    CALCULATE(DISTINCTCOUNT(Sales[Order ID]), FILTER(Sales,Sales[Product ID]=100))

     

    Post more details with sample data if you need exact solution.

     

    Thanks

    Raj

    • rdallimore's avatar
      rdallimore
      Frequent Visitor

      Many thanks Raj - it was the FILTER that i needed.

       

      many thanks

       

      Rich