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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AnnaML
Frequent Visitor

Line value disappears in Combo Chart

Hello, 

 

I'm currently working on a combo chart visualising hours worked per department, actuals vs target. Hours is called HpT. I only want to show one department by default when opening the report and than be able to filter on another department. 

I created the following to be able to get one of the department as default (29221 is the department): 

FA1 Dep Actuals =
IF(COUNTROWS(DISTINCT(ALLSELECTED(Weekly[Department]))) < COUNTROWS(DISTINCT(ALL(Weekly[Department]))) , CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Actual" })
,
IF(SELECTEDVALUE(Weekly[Department]) = "29221",CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Actual" }) ))
 
I created the same for Target as well: 
FA1 Dep Target =
IF(COUNTROWS(DISTINCT(ALLSELECTED(Weekly[Department]))) < COUNTROWS(DISTINCT(ALL(Weekly[Department]))) , CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" })
,
IF(SELECTEDVALUE(Weekly[Department]) = "29221",CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" }) ))
 
When adding these two to a combo chart the target line disappears. Does anyone know what the issue can be? 

I can see the hours for both actuals and targets by week if I add the created fields to a table. But as soon as I change the visualization to a combo shart the target line disappears (see picture below)

AnnaML_0-1611758010876.png

As you can see in the picture, the actuals for department 29221 is showing but the line for target is not showing. 

Thankful for support, 


 

 

3 REPLIES 3
amitchandak
Super User
Super User

@AnnaML , Try like

 

FA1 Dep Target =
IF(COUNTROWS(DISTINCT(ALLSELECTED(Weekly[Department]))) < COUNTROWS(DISTINCT(ALL(Weekly[Department]))) , CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" })
,
IF(countx(filter(allselected(Weekly) ,Weekly[Department] = "29221"),Weekly[Department) <> blank(),CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" }) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for your answere. I tried and got the following:

AnnaML_0-1611821284549.png

Now I get the target line but for all departments and not just department "29221". Do you know what might be the problem? 

 

Thanks in advance 

Hi @AnnaML ,

 

FA1 Dep Target =
IF(COUNTROWS(DISTINCT(ALLSELECTED(Weekly[Department]))) < COUNTROWS(DISTINCT(ALL(Weekly[Department]))) , CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" })
,
IF(SELECTEDVALUE(Weekly[Department])= "29221"),CALCULATE(SUM('Weekly'[HpT]), 'Weekly'[Scenario] IN { "Target" }) ))

 If the measure still doesnt work,would you pls provide some sample data with expected output?

 

Best Regards,
Kelly

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors