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
Danielnir
Helper II
Helper II

Slicer showing blank values for some categories

Hi,

 

I wrote two metrics. One for summarising invoice values and currency exchange and the second to interact with the slicer. The problem that I have is that when I'll choose slicer options "Sales", "Direct Expences" or "Overheads", chartis showing correct information. When I select "Net Profit/Loss" or "Gross Profit/Loss", the chart is blank. There is no rocket science here so I don't know what went wrong. May I ask for your assistance?

 

Invoice value & currency exchange:

SQL_Actual_Adjusted = 
var SQL_Values = sum('SQL_NLPostedNominalTran - Transactions'[GoodsValueInBaseCurrency])
var Region = selectedvalue('DIM_Regions and Logos'[Short Country Code])
var currency_opt = selectedvalue('DIM_Currency'[Currency])
var USD_GBP = average('DIM_Exchange USD / GBP'[USD/GBP])
VAR GBP_USD = average('DIM_Exchange GBP / USD'[GBP/USD])
var Meta = selectedvalue(DIM_Categories_PnL[Meta Category])
var Goods_Value = if(Meta="SALES",SQL_Values*(-1),SQL_Values)
var UK_GBP = calculate(Goods_Value,'SQL_NLPostedNominalTran - Transactions'[Region]="UK")
var UK_USD = calculate(Goods_Value,'SQL_NLPostedNominalTran - Transactions'[Region]="UK")*GBP_USD
var USA_GBP = calculate(Goods_Value,'SQL_NLPostedNominalTran - Transactions'[Region]="USA")*USD_GBP
var USA_USD = calculate(Goods_Value,'SQL_NLPostedNominalTran - Transactions'[Region]="USA")

return

SWITCH(
    TRUE(),
    Region = "UK",if(currency_opt = "GBP",UK_GBP,UK_USD),
    Region = "USA",if(currency_opt = "GBP",USA_GBP,USA_USD))

the one which interacts with the slicer:

TIMESERIES SWITCH ACTUAL = 
VAR OPTION = SELECTEDVALUE('DIM_Meta Cat Order'[Meta Category - Copy])

VAR SALES_V = CALCULATE([SQL_Actual_Adjusted],DIM_Categories_PnL[Meta Category]="SALES")
VAR DIRECT_EXP = CALCULATE([SQL_Actual_Adjusted],DIM_Categories_PnL[Meta Category]="DIRECT EXPENCES")
VAR OVERHEADS = CALCULATE([SQL_Actual_Adjusted],DIM_Categories_PnL[Meta Category]="OVERHEADS") 
VAR NET_VAL = SALES_V-DIRECT_EXP-OVERHEADS
VAR GROSS_VAL = SALES_V-DIRECT_EXP

RETURN

SWITCH(
    TRUE(),
    OPTION = "SALES", SALES_V,
    OPTION = "DIRECT EXPENCES",DIRECT_EXP,
    OPTION = "OVERHEADS", OVERHEADS,
    OPTION = "NET PROFIT/LOSS", NET_VAL,
    OPTION = "GROSS PROFIT/LOSS", GROSS_VAL)

 

Kind regards,

Daniel

1 REPLY 1
MFelix
Super User
Super User

Hi @Danielnir ,

 

What is the axis values on the chart? Is it based on a column that you have related with all you measures?

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.