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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dom
Frequent Visitor

Distinct count but only if value exists in another table weekly

Hello Power BI friends

I wonder if you help me solve the challenge I have.

The data model has 3 tables calendar, table 1 with SKUs planned for production and table 2 SKUs actually produced. I need to calculate weekly adherence to the production plan - count the number of SKUs produced but only if they were planned ( exists in table 1). Here is my table structure:

TABLE 1 - products planned for production

dom_1-1621404486585.png

Table 2 products actually produced

dom_2-1621404520044.png

Below is an example of what  I would like to achieve:

Week no       #SKUS planned      #SKUs planned and filled        Adherence to plan (SKUs produced/ SKUsplanned)

1                             120                                100                                    83%

2                             180                                179                                    99%

I would appreciate your help

Thanks

Dom

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@dom , Try a measure like

#SKUs planned and filled = calculate(distinctcount(Table2[SKU]), filter(Table2, Table2[sku] in values(Table1[sku])))

 

you can also explore treatas

https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@dom , Try a measure like

#SKUs planned and filled = calculate(distinctcount(Table2[SKU]), filter(Table2, Table2[sku] in values(Table1[sku])))

 

you can also explore treatas

https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/

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 @amitchandak that worked 🙂

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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