cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
CoffeeTime Visitor
Visitor

SUMX returns blank value. Probably due to incorrect relationship.

Hi, guys.

 

I am fairly new to Power BI, so...here it goes.

 

I am trying to create a dashboard for some stocks. I might have related the tables incorrectly since I sometimes get a blank result or the same valeu for different filters. 

 

Here are the tables I am using:

 

  • Proventos  - Provides the dividends each stock payed over time
  • Calendário - Calendar
  • Ticker - Provides the Stock Name given its ticker
  • Cotações - Historical stock quotes (Had to create a primary key called Chave concatenating Ticker and Date)
  • Transações - My transactions with quantities, value and date for each ticker (Had to create a primary key called Chave concatenating Ticker and Date)
  • Indicadores - Present time indicators for each ticker

I attatched a picture of the relationship I established.

 

Relationship 

 

I created a measure of quantity of stocks I had/have (I sumed all bquatity bought and subtracted quantity sold):

 

Quantidade Carteira = CALCULATE(SUM('Transações'[Quantidade]);'Transações'[Transação]="Compra") - CALCULATE(SUM('Transações'[Quantidade]);'Transações'[Transação]="Venda")

 

Then I needed to multiply the stock price by the quantity I had to have my wallet value. For that I used:

 

Valor Carteira = SUMX('Cotações'; [Quantidade Carteira]*'Cotações'[Cotações]) 

 

I keep getting a blank result for this last measure. Therefore, I think I might have related the tables incorrectly.

 

Thnx for the help.

 

1 REPLY 1
v-jayw-msft Senior Member
Senior Member

Re: SUMX returns blank value. Probably due to incorrect relationship.

Hi @CoffeeTime,

 

I tried to create Transações table and Cotações table including their relationship.

The measures work fine and the result is correctly.

I think there might be something wrong about the relationship between other tables.

It's hard to find the errors only by the picture, could you please share your pbix to me if you don’t have any Confidential Information?

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)