Forum Discussion

NELfr's avatar
NELfr
New Member
3 years ago
Solved

Calculate column

Hi,

 

Please share your knowledge with me helping me with this issue

 

I have a file with a column "activación_flag" that contains only two values repeatedly (1 and 0) which mean that the 1 are activate and the 0 inactivate status

 

Well im trying to create a meassure or column that indicate the % of 1 and 0 based on the grand total

 

Any ideas?

 

 

  • Hi, NELfr 

    According to your description , you want to " trying to create a meassure or column that indicate the % of 1 and 0 based on the grand total".

    For your need , i recommend you to use the measure to realize your need.

    Here are the steps you can refer to :

    (1)This is my test data:

    (2) We can create a measure like this:

    % = DIVIDE(COUNT('Table'[activación_flag]) , CALCULATE( COUNT('Table'[activación_flag]) , ALL('Table')))

    (3)Then we can put the field and the measure on the visual and we will meet your need , the result is as follows:

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

3 Replies

  • Hi NELfr , if you have a table (column) something like this:

     

    You can create this 2 measures:

    Activate = DIVIDE(CALCULATE(sum('Table'[activation_flag]),
    'Table'[activation_flag]=1),COUNTROWS('Table'),"-")
    Inactive = 1 - [Activate]

    Best regards

  • Hi, NELfr 

    According to your description , you want to " trying to create a meassure or column that indicate the % of 1 and 0 based on the grand total".

    For your need , i recommend you to use the measure to realize your need.

    Here are the steps you can refer to :

    (1)This is my test data:

    (2) We can create a measure like this:

    % = DIVIDE(COUNT('Table'[activación_flag]) , CALCULATE( COUNT('Table'[activación_flag]) , ALL('Table')))

    (3)Then we can put the field and the measure on the visual and we will meet your need , the result is as follows:

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Hi,

    Try these measures

    Total = countrows(Data)

    Activations = calculate([Total],Data[Activation_flag]=1)

    De-activations = calculate([Total],Data[Activation_flag]=0)

    Activations % = divide([Activations],[Total])

    De-activations % = divide([De-activations],[Total])

    Drag the last two measures to a multi card visual.

    Hope this helps.