Forum Discussion

Kostas's avatar
Kostas
Icon for Helper IV rankHelper IV
6 years ago
Solved

Measure to show value based in a list with multiple variables

Hello everyone,  I am currently designing a dashboard with Power BI and I will need some help to overcome an issue that I have.  I have created dummy data to explain the issue, I am basically need ...
  • v-alq-msft's avatar
    6 years ago

    Hi, Kostas 

     

    Based on your description, you may create two measures and a column as below.

     

    Calculated column:
    IsCompleted Column = 
    var _theme = 'Table'[Theme]
    var _id = 'Table'[ID]
    return
    
        IF(
            COUNTROWS(
                FILTER(
                    ALL('Table'),
                    'Table'[Theme] = _theme&&
                    'Table'[ID] = _id
                )
            )
            =
            COUNTROWS(
                FILTER(
                    ALL('Table'),
                    'Table'[Theme] = _theme&&
                    'Table'[ID] = _id&&
                    'Table'[Answer] = "Exist"&&
                    'Table'[Conclusion] = "Exist"
                )
            ),
            "complete",
            "not complete"
        )
    
    Measure:
    IsCompleted Measure = 
    var _theme = SELECTEDVALUE('Table'[Theme])
    var _id = SELECTEDVALUE('Table'[ID])
    return
    IF(
        ISFILTERED('Table'[Theme])&&ISFILTERED('Table'[ID]),
        IF(
            COUNTROWS(
                FILTER(
                    ALL('Table'),
                    'Table'[Theme] = _theme&&
                    'Table'[ID] = _id
                )
            )
            =
            COUNTROWS(
                FILTER(
                    ALL('Table'),
                    'Table'[Theme] = _theme&&
                    'Table'[ID] = _id&&
                    'Table'[Answer] = "Exist"&&
                    'Table'[Conclusion] = "Exist"
                )
            ),
            "complete",
            "not complete"
        )
    )
    
    Count = 
    DISTINCTCOUNT('Table'[ID])

     

     

    Result:

     

    Best Regards

    Allan

     

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

  • v-alq-msft's avatar
    v-alq-msft
    6 years ago

    Hi, Kostas 

     

    Actually, IsCompleted Column is the same logic as the IsCompleted Measure. The measure is calculated in the specific context while the column is in the data model. You need to use the IsCompleted as a legend in the pie chart, so you have to use the column. While the measure is calculated in the pivot table for clear display.

     

    Best Regards

    Allan