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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jahlum1
New Member

Calculation using distinct counts form two different matrix tables

I have two separate matrix tables with the data below -

 

Matrix 1:

Week of the Year [YRWK] a record was completed

Count of records completed during each YRWK [Count of TD_comp]

 

Matrix 2:

Week of the Year [YRWK_created] a record was created

Count of records created during each YRWK_created [Count of TD_created]

Screenshot 2025-09-30 144354.png

 

How would I go about creating a calculation using these separate tables that is [Count of TD_comp] - [Count of TD_created] for each Week of the Year?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1759260284080.png

 

Jihwan_Kim_0-1759260271095.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
v-achippa
Community Support
Community Support

Hi @jahlum1,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @AmiraBedh@Jihwan_Kim and @Bmejia for the prompt response. 

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @jahlum1,

 

We wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1759260284080.png

 

Jihwan_Kim_0-1759260271095.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Just to add to conversation to Jihwan_Kim post.  I would probably make the Period a dynamic table the way you won't have to be entering the YRWK everytime you have a new value.  The table below would look at the max YRWK and Min YRWK from both tables to generate a list.

 

Bmejia_0-1759265066624.png

Period =
VAR MinYYWK = IF(Min(Completed[YYWK])>Min(Created[YYWK]),Min(Completed[YYWK]),Min(Created[YYWK]))
VAR MaxYYWK = IF(Max(Completed[YYWK])>Max(Created[YYWK]),Max(Completed[YYWK]),Max(Created[YYWK]))
RETURN
GENERATESERIES(MinYYWK,MaxYYWK,1)
AmiraBedh
Super User
Super User

Hello !

Thank you for posting on Microsoft Fabric community.

You need to reate a date table with a date column and a YrWk key for exampleYYYYWW and creare 2 relationships with your fact table twice:

  • active: date[date] to fact[createddate]

  • inactive: date[date] to fact[completeddate]

TD Created =
CALCULATE(
    DISTINCTCOUNT(fact[TD #]),
    USERELATIONSHIP('date'[date], fact[createddate])
)

TD Completed =
CALCULATE(
    DISTINCTCOUNT(fact[TD #]),
    USERELATIONSHIP('date'[date], fact[completeddate])
)

TD Delta = [TD Completed] - [TD Created]

then put 'date'[YrWk] on the matrix rows and show [TD Delta].


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.