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
mtomova
Helper III
Helper III

How to use SWITCH & CALCULATE to calculate from one table, by applying filter from a second table

Hi All!

 

I am trying to create a calculated measure by using SWITCH & CALCULATE to cover multiple statuses.

The information I use is separated in two different tables, there is a connection between the tables, 

however, my CALCULATE is not returning any result.

 

The two tables are HH and Measures.

For one HH(Household) I can have multiple entries in the Measures table. The two tables are related by unique reference number for each Household.

 

Based on a SWITCH statement that is being true, if a Household Ops status = X
Then count number of referals in Measures table, if criteria met.

 

My Calculation returns nothing:

 

SWITCH(TRUE(),
FIRSTNONBLANK('HH'[Ops Status], 1) = "Allocated to Installer (Measures)",
CALCULATE(COUNT('Measure'[SURVEYMEASUREVIEW::Reference]), 'Measure'[Measure Ops Status] = "Allocated to Installer (Measures)"),

FIRSTNONBLANK('HH'[Ops Status], 1) = "Allocated to Installer (Measures)",

CALCULATE(COUNT('Measure'[SURVEYMEASUREVIEW::Reference]), 'Measure'[Measure Ops Status] = "Awaiting technical survey (Measures)"),

etc...

)
2 REPLIES 2
mtomova
Helper III
Helper III

Hello, @amitchandak !
Apologies for the late response!
HH table:

ReferenceOps Status
100601Awaiting Whole House Plan
100606Retrofit Design Approved (Household)
100608Allocated to Installer (Household)
100613Awaiting Whole House Plan
100621Awaiting Inspection
100622Allocated to Installer (Household)
100631Allocated to Installer (Household)
100635Allocated to Installer (Household)
100638

Retrofit Design Approved (Household)

 

Measures table:

ReferenceMeasure Ops Status
100606Retrofit Design Approved (Measures)
100606Retrofit Design Approved (Measures)
100606Measure Billed
100606Measure Billed
100606Retrofit Design Approved (Measures)
100608Allocated to Installer (Measures)
100608Retrofit Design Approved (Measures)
100608Measure Billed
100608Measure Billed
100621Measure Billed
100621Measure Billed
100621Measure Billed
100621Measure Billed
100622Allocated to Installer (Measures)
100622Measure Billed
100622Measure Billed
100631Allocated to Installer (Measures)
100631Allocated to Installer (Measures)
100631Measure Billed
100631Measure Billed
100631Measure Billed
100631Retrofit Design Approved (Measures)
100635Allocated to Installer (Measures)
100635Allocated to Installer (Measures)
100635Measure Billed
100635Measure Billed
100638Measure Billed
100638Measure Billed
100638Retrofit Design Approved (Measures)

 

 

I am not sure if there is a way to upload these tables as files.
I could not find how to do it, apologies if the format is not user friendly!

amitchandak
Super User
Super User

@mtomova ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors