Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

calculating measure

Hi ,

i am new to power bi. please help me

 

I want to write a mearsure  like below

 

Count(a)>1 and aa='XYZ' then 1

Count(a)=1 and aa='ABC' then 2

  • Try like

    measure2 = if([meausre1]>0,if(firstnonblank(table[aa],blank())="XYZ",1,if(firstnonblank(table[aa],blank())="ABC",2,0)),0)

  • Hi,

     

    I create a sample to test:

    Please try this measure:

     

    Measure = DISTINCTCOUNT('Table'[CustomerID])

     

    Choose [Gender] and [type] and this measure as a table visual, it shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

3 Replies

  • Try like

    measure2 = if([meausre1]>0,if(firstnonblank(table[aa],blank())="XYZ",1,if(firstnonblank(table[aa],blank())="ABC",2,0)),0)

    • Anonymous's avatar
      Anonymous
      Not applicable

      I need to count(distinct custid's) based on type, gender , how write formula for that

      • v-gizhi-msft's avatar
        v-gizhi-msft
        Community Support

        Hi,

         

        I create a sample to test:

        Please try this measure:

         

        Measure = DISTINCTCOUNT('Table'[CustomerID])

         

        Choose [Gender] and [type] and this measure as a table visual, it shows:

        Hope this helps.

         

        Best Regards,

        Giotto Zhi