Forum Discussion

Lwpro's avatar
Lwpro
Frequent Visitor
2 years ago
Solved

Troubleshooting Competitor Share Calculation in Power BI Dashboard

Hello everyone,   I'm facing some issues with measures in Power BI and would like to ask for the community's help in resolving these matters. Currently, I'm working on a management dashboard that ...
  • Anonymous's avatar
    Anonymous
    2 years ago

     Thanks for the reply from some_bih , please allow me to provide another insight:
    Hi,Lwpro 

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

    2. I have a question if you can answer me: is "'Measures'[% share]" a measure or a calculated column? Because I can't create a table named "'Measures" in the real test, and in the CALCULATE() function his first position is needed for the expression, the screenshot of the reported error is as follows:

    According to your expression, I will consider it as a measure in the following solution.

    3.Secondly, if your field is indeed the content of a table, you can try to establish a relationship between the two tables in which case you can correlate the content of the two tables.

    4.Finally, you can try the following measure:

    % Competitors' Share = 
    CALCULATE(
    'Measures'[% share],
    FILTER(ALLSELECTED(Brand),'Brand'[Brand]<> "My Brand")
    )
    

    If you use the ALLSELECTED() function, the ALLSELECTED() function gets the context that represents all the rows and columns in the query, while retaining the context outside of the explicit filters and row and column filters. , the following is a simple example:

     

    Here is the related documentation:

    ALLSELECTED function (DAX) - DAX | Microsoft Learn

    5.Here's my final result, which I hope meets your requirements.

     

    Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

    Best Regards,

    Leroy Lu

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