Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Can not show all items when items not belong to a selection

Hi everyone, 

I want to calculate how much each market spend on its campaign.

Logic:

If Category = "Other", cost of this campaign with be distributed to all Category in "distribute" table by % recpectively.

 

My measure:

SEM Cost before distribute = sum(cost[cost])+0
 
SEM Cost =
var other = CALCULATE([SEM Cost before distribute] , filter(all(category), category[category] = "other"))
var _percent =SELECTEDVALUE(distribute[%])
return
IF(SELECTEDVALUE(category[category]) = "other" , other*_percent, [SEM Cost before distribute] + other*_percent)
 
The model:

ngocpt00_0-1665052840907.png

 

The records of each table:

ngocpt00_1-1665052890356.png

What the dashboard shows:

 

ngocpt00_6-1665053975638.png

ngocpt00_5-1665053955259.png

What I expect:

- When select market "fb":

CategorySEM Cost
hats0,00
jeans1.4
other0.2
shirts0.4

 

- When select market "bing"

CategorySEM Cost
hats0,00
jeans7.7
other0.1
shirts0.2

 

Hope to hear from you guys soon. Thank you so much

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

The relationships in your model caused the error.

Try to change like this.

vstephenmsft_0-1665134466251.png

 

Then results are what you want.

vstephenmsft_1-1665134495238.png

vstephenmsft_2-1665134501863.png

You can download my attachment for details.

Create and manage relationships in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Stephen Tao

 

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

 

View solution in original post

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

The relationships in your model caused the error.

Try to change like this.

vstephenmsft_0-1665134466251.png

 

Then results are what you want.

vstephenmsft_1-1665134495238.png

vstephenmsft_2-1665134501863.png

You can download my attachment for details.

Create and manage relationships in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Stephen Tao

 

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

 

Anonymous
Not applicable

Hi @v-stephen-msft 

Thank you so much for your help

In case it is not allowed to change the model, is there any ways to resolve it? Thank you

Hi @Anonymous ,

 

Since you can't change the model, it's hard to achieve.

Due to the limitations of the relationships, your % is not passed correctly.

Is it okay to create a new table through a calculated table or add a new table to the data source?

 

 

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.