How to set default value for column in SSAS

raphael chimello 0 Reputation points
2023-06-07T15:55:13.3133333+00:00

Hi, I have a PowerBI Report that consumes an SSAS cube, I have a field called domain in my fact table, and this field has a relation with a domain-list dimension, in case the domain present in the fact table is not present in the domain-list dimension, the value is set to blank. I want to change this blank to "not valid", is there any way to do this?

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-06-08T00:59:20.8833333+00:00

    Yes, you can change the blank values in your Power BI report to "not valid" using calculated columns or measures. Here's suggested steps by chatGPT:

    • Open your Power BI report and go to the data view.
    • Locate the fact table that contains the "domain" field and the domain-list dimension table.
    • Create a relationship between the fact table's "domain" field and the corresponding field in the domain-list dimension table.
    • In the fact table, right-click on the "domain" field and select "Manage Roles" from the context menu. This will open the Roles Manager dialogue.
    • In the Roles Manager dialogue, click on the "Create" button to create a new role.
    • In the new role, specify a name (e.g., "Not Valid") and click on the "OK" button.
    • With the "Not Valid" role selected, go to the "Table" menu and select "New Column" to create a new calculated column.
    • In the formula bar, enter the following formula to replace blank values with "not valid":
    NewColumn = IF(ISBLANK('FactTable'[Domain]), "not valid", 'FactTable'[Domain])
    
    • Press Enter to apply the formula. This will create a new calculated column in the fact table, replacing blank values with "not valid".
    • Return to the "Manage Roles" dialogue and assign the "Not Valid" role to yourself or any other users who should see the modified values.

    Now, when you view your Power BI report with the "Not Valid" role, any blank values in the "domain" field will be replaced with "not valid". Users without this role will continue to see the original blank values.

    Note that using calculated columns will store the modified values in the fact table, which can impact storage and processing. If you prefer a dynamic approach without modifying the data, you can use measures instead of calculated columns. In this case, you would create a measure with the same logic to display "not valid" when the domain is blank.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.