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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
databubble
Frequent Visitor

Boolean measure breaks relationship?

Hi

 

I have tables DimSalesperson and FactSales. They are related by SalesPerson

 

DimSalesperson:

SalespersonTargetTotalSales
Amit4000
Barbara5000
Carolina6000
Deng7000

 

FactSales:

InvoiceNumSalesDateSalesPersonGrossInvoiceSalesTax
123/3/2016Deng758.8592
229/3/2016Barbara154.9398.97
35/4/2016Barbara651.5662.97
414/4/2016Deng262.223.63
524/4/2016Amit674.1794.68
630/4/2016Barbara468.9326.42
78/5/2016Carolina256.989.74
817/5/2016Deng939.9797.21
…etc...…etc...…etc...…etc...…etc...

 

I added three measures to FactSales:

 

  • NetAmt = sum('Fact'[GrossInvoice]) - sum('Fact'[SalesTax])
  • DiffToSalesTarget = [NetAmt]-min('Fact'[SalesTarget])
  • MetSalesTarget = [NetAmt] > min('Fact'[SalesTarget])

 

And I have a basic table visualistion showing total netAmt for each SalesPerson. (I have included Salesperson twice - once from Dimension and once from Fact - to clarify the later problem)

 

NetAmtSalesPersonSalesperson
4173.67AmitAmit
5905.81BarbaraBarbara
2249CarolinaCarolina
4262DengDeng

 

 

I can add TargetTotalSales and DiffToSalesTarget and it behaves as expected - the values are calculated in context.

 

NetAmtSalesPersonSalespersonTargetTotalSalesDiffToSalesTarget
4173.67AmitAmit4000173.67
5905.81BarbaraBarbara5000905.81
2249CarolinaCarolina6000-3751
4262DengDeng7000-2738

 

However if I add MetSalesTarget, for each sales person in the Fact table, I get a line for every SalesPerson in the Dimension table. It is as if the relationship no longer exists.:

 

NetAmtSalesPersonSalespersonTargetTotalSalesDiffToSalesTarggetMetSalesTarget
4173.67AmitAmit4000173.67TRUE
 AmitBarbara5000 FALSE
 AmitCarolina6000 FALSE
 AmitDeng7000 FALSE
 BarbaraAmit4000 FALSE
5905.81BarbaraBarbara5000905.81TRUE
 BarbaraCarolina6000 FALSE
 BarbaraDeng7000 FALSE
 CarolinaAmit4000 FALSE
 CarolinaBarbara5000 FALSE
2249CarolinaCarolina6000-3751FALSE
 CarolinaDeng7000 FALSE
 DengAmit4000 FALSE
 DengBarbara5000 FALSE
 DengCarolina6000 FALSE
4262DengDeng7000-2738FALSE

 

What am I doing wrong? 

 

Many thanks

Liz

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@databubble

 

Hi, applied a visual filter and will work.

 

Showno.png




Lima - Peru

Hi

 

Thank you for helping with my problem.

 

I see a filter gives the results I want, but it feels like a workaround to a problem in my measure. I am new to Power BI and not sure what is good practice! Is it usual to generate and filter out the "wrong" results ?

 

Liz

 

@databubble,

Generally, we don’t drag SalesPerson fields of both table to create a visual. We only drag SalesPerson field from either DimSalesperson table or FactSales table to visuals in Power BI, this way, expected result will return.

Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.