Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Aggregating text values from rows

I have 3 tabels. 

Table 1 contains a series of Policy numers

Table 2 Each Policy has 1 or more line items, which represent a coverage. They are represented by a TypeNr

Table 3. Each coverage (TypeNr) is either a saving of risc.

 

What I need, is a column is table 1, which shows if the policy only have items of the type Saving, Risc og Both. Any help will be greatly appreciated

 

 

 

 

 

 

  • Hi,

    I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

    It is for creating a new table.

     

     

     

    Expected result new table =
    VAR _t =
        SUMMARIZE ( Policy_Type, Policy[Policy], 'Type'[Type] )
    VAR _condition =
        ADDCOLUMNS (
            _t,
            "@Coverage",
                IF (
                    COUNTROWS ( FILTER ( _t, Policy[Policy] = EARLIER ( Policy[Policy] ) ) ) > 1,
                    "Both",
                    'Type'[Type]
                )
        )
    RETURN
        SUMMARIZE ( _condition, Policy[Policy], [@Coverage] )
    

     

     

2 Replies

  • Hi,

    I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

    It is for creating a new table.

     

     

     

    Expected result new table =
    VAR _t =
        SUMMARIZE ( Policy_Type, Policy[Policy], 'Type'[Type] )
    VAR _condition =
        ADDCOLUMNS (
            _t,
            "@Coverage",
                IF (
                    COUNTROWS ( FILTER ( _t, Policy[Policy] = EARLIER ( Policy[Policy] ) ) ) > 1,
                    "Both",
                    'Type'[Type]
                )
        )
    RETURN
        SUMMARIZE ( _condition, Policy[Policy], [@Coverage] )
    

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you - that was exactly what I needed