Forum Discussion

Ali123's avatar
Ali123
Advocate I
4 years ago
Solved

Access column from Table store in variable

Use filter function for filtering data then i save it into one variable "newTable".
Now i want to access disitinct vlaues from one of column filter table but cannot access column form table store in variable.
How can i do this in single step?

  • Hey Ali123 ,

     

    it doens't really work like that with variables. You cannot just replace a table with a variable and access the column.

    In general the following approach shoud work:

    Category =
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                telecom_customer_churn,
                telecom_customer_churn[churn Category] <> BLANK ()
            ),
            "churn Category", [churn Category]
        )
    )
    

     

    For filtering CALCUALTETABLE is the better choice compared to FILTER, so would even use the following approach:

    Category =
    DISTINCT (
        SELECTCOLUMNS (
            CALCULATETABLE (
                telecom_customer_churn,
                telecom_customer_churn[churn Category] <> BLANK ()
            ),
            "churn Category", [churn Category]
        )
    )
    

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution βœ”οΈ and give it a thumbs up πŸ‘

    Best regards
    Denis

    Blog: WhatTheFact.bi
    Follow me: twitter.com/DenSelimovic

1 Reply

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Ali123 ,

     

    it doens't really work like that with variables. You cannot just replace a table with a variable and access the column.

    In general the following approach shoud work:

    Category =
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                telecom_customer_churn,
                telecom_customer_churn[churn Category] <> BLANK ()
            ),
            "churn Category", [churn Category]
        )
    )
    

     

    For filtering CALCUALTETABLE is the better choice compared to FILTER, so would even use the following approach:

    Category =
    DISTINCT (
        SELECTCOLUMNS (
            CALCULATETABLE (
                telecom_customer_churn,
                telecom_customer_churn[churn Category] <> BLANK ()
            ),
            "churn Category", [churn Category]
        )
    )
    

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution βœ”οΈ and give it a thumbs up πŸ‘

    Best regards
    Denis

    Blog: WhatTheFact.bi
    Follow me: twitter.com/DenSelimovic