Forum Discussion

faldiwan's avatar
faldiwan
Frequent Visitor
2 years ago

ALLSELECTED OR NOT?

Hi all,

 

I need some help please, I have a simple tabular model.
3 tables Portfolio, Position & Date.

The Portfolio table is pretty much a type 1 dimension, Position is a fact table. 

The visual I have contains data from mainly the portfolio table and 2 measures from the Position and a date selected. There is only one filter from the Portfolio table, where they selected 2 companies out of the list of 5 companies.

CompanyInvestmentValueOverall Value
XA1001100
YB10001100

 

This is the data i get and its fine, but the issue is that, I want to be able to keep selecting the 2 companies and if I put an extra filter to select 1 investment, id like to see the overall value stay as 1100 because ive selected the 2 companies.

 

The DAX I have used for Overall Value = CALCULATE( SUM(Value), REMOVEFILTERS(Portfolio), ALLSELECTED(Portfolio[Company]))

This works fine, when all investments appear, but when filtering down to 1, it only gives me the overall value of the company within the investment. Dont understand why? It looks like the below:

CompanyInvestmentValueOverall Value
XA100100

 

Where I would like to keep seeing 1100 in the overall value.

Any help would be much appreciated.

8 Replies

  • You need to do  REMOVEFILTERS/ALLSELECTED on the investment as well. And if you have a sort column then you need to include that too etc.

  • faldiwan's avatar
    faldiwan
    Frequent Visitor

    Hi 

    I did CALCULATE( SUM(Amont), Removefilters(InvestmentCode), ALLSELECTED(Company))

    Still only returns the amount within the company in the investment

    • lbendlin's avatar
      lbendlin
      Super User

      Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

      Do not include sensitive information or anything not related to the issue or question.

      If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

      Please show the expected outcome based on the sample data you provided.

      Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

      • faldiwan_ar's avatar
        faldiwan_ar
        Frequent Visitor

        Position table:

        PortfolioIdTotalValue
        11000
        22000
        33000

         

        Portfolio table:

        IdCompanyInvestment
        1Test1Apple
        2Test2Amazon
        3Test3Arm

         

        Report:

        CompanyInvestmentTotal ValueOverall
        Test1Apple10004000
        Test3Arm30004000

         

        If I use the following day for Overall:
        CALCULATE( SUM(TotalValue), REMOVEFILTERS(Portfolio[Investment]), ALLSELECTED(Portfolio[Company])

         

        I get the Report table above, which is great, BUT if i only select "Investment = A" in the filter "Filters on this visual" I only get Overall = 1000, because it looks like its summing within the selected investments.

         

        Model example:

         

        Works when selecting 2 companies and all investments within the companies.

         

        When then selecting only 1 investment, should expect to see 4000, but shows only value within the 1 investment selected, need to see the 4000