Home > Net >  the sum function cannot work with string values
the sum function cannot work with string values

Time:10-12

I'm working with DAX in PowerBI. I hava a column with 80 000 string values. 70% of these values is "European Desk". I want to show this percentage. It's string value, i don't understand how to do it with DAX

Any advice ?

CodePudding user response:

The measure you are looking for is

% European Desk = DIVIDE(
    CALCULATE(
        COUNT('Table'[String]),
        'Table'[String] = "European Desk"
    ),
    COUNT('Table'[String])
)

With CALCULATE you can change the filter context for the COUNT() aggregation.

You can apply this formula to e.g. this table:

Table = DATATABLE(
    "Index", INTEGER,
    "String", STRING,
    {
        {1, "European Desk"}, 
        {2, "European Desk"},
        {3, "European Desk"},
        {4, "African Desk"},
        {5, "Asian Desk"}
    }   
)
  • Related