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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
CoffeeTime
Frequent 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
Community Support
Community Support

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.

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

Helpful resources

Announcements
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.