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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rmeng
Helper II
Helper II

Count Values from two Fact tables with blanks

Hello,

I have a star schema with 2 fact tables. I need two metrics from both tables in a new visual table:

# Distinct Count From Call ID Fact1 table = DistinctCount(FACT1[CallID])

# Count of Strategies from FACT 2

The problem is that there are missing  strategies from table Fact2.

In the new visual table I need that Calls Id = null for # Count of Strategies metric when strategies don´t exists. 

rmeng_0-1643197381220.png

Can you help me with this?

2 ACCEPTED SOLUTIONS
SteveHailey
Solution Specialist
Solution Specialist

Hello @rmeng. You could do something like this:

 

# Number of Strategies (FACT 2) = 
IF(
    ISBLANK(
        CALCULATE(
            COUNTROWS( 'Fact 2' ),
            TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
        )
    ),
    "null",
    CALCULATE(
        COUNTROWS( 'Fact 2' ),
        TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
    )
)

 

SteveHailey_0-1643205486226.pngSteveHailey_1-1643205513549.png

I attached a .pbix file here, in case it's helpful.

 

-Steve

View solution in original post

Anonymous
Not applicable

Hi @rmeng ,

 

According to your screenshot, I think you couldn't make all relationships active or you will get a cycle in data model.

For reference: Manage relationship

Here I choose to inactive "DIM Date"[Date] to "FACT 2"[Date].

1.png

You just need to add Strategie column in it and use count function in values field. In your table visual, it will show blank if there is no strategie in Fact2. 

1.png

Or create a easy measure to show null.

Measure = 
VAR _Count = COUNT('FACT 2'[Strategie])
return
IF(ISBLANK(_Count),"null",_Count)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @rmeng ,

 

According to your screenshot, I think you couldn't make all relationships active or you will get a cycle in data model.

For reference: Manage relationship

Here I choose to inactive "DIM Date"[Date] to "FACT 2"[Date].

1.png

You just need to add Strategie column in it and use count function in values field. In your table visual, it will show blank if there is no strategie in Fact2. 

1.png

Or create a easy measure to show null.

Measure = 
VAR _Count = COUNT('FACT 2'[Strategie])
return
IF(ISBLANK(_Count),"null",_Count)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

SteveHailey
Solution Specialist
Solution Specialist

Hello @rmeng. You could do something like this:

 

# Number of Strategies (FACT 2) = 
IF(
    ISBLANK(
        CALCULATE(
            COUNTROWS( 'Fact 2' ),
            TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
        )
    ),
    "null",
    CALCULATE(
        COUNTROWS( 'Fact 2' ),
        TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
    )
)

 

SteveHailey_0-1643205486226.pngSteveHailey_1-1643205513549.png

I attached a .pbix file here, in case it's helpful.

 

-Steve

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.