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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
robertosangi
Helper I
Helper I

COUNT and difference

I want to reproduce this situation in PowerBi.

 

I have three different tables named: Wn-1, Wn, Person

 

I wanted to know how much work did each person inside the table Person between the two weeks. 

 

robertosangi_0-1645786681943.png

 

Practically I need firstly to count in Wn-1 how many cases are in charge for each person. After this i need to do the same for the Wn table and finally I need a difference beetween them.

 

I'm not able to do so. I'm trying to do it in Data context in PowerBi

Please help


Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @robertosangi ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create relationships between Wn, Wn-1 and Person table base on the field Person just as below screenshot

yingyinr_0-1646116496934.png

2. Create two measures as below to get the count of cases in Wn and Wn-1

Wn = COUNT('Wn'[#Case])
Wn-1 = COUNT('Wn-1'[#Case])

3. Create a measure as below to get the difference between Wn and Wn-1

Difference = [Wn]-[Wn-1]

4. Create a table visual as below screenshot

yingyinr_1-1646116652644.png

Best Regards

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@robertosangi , Join both of them with person Table

 

Then

wn -1 cases =sum( 'Wn-1'[Cases#])

 

wn cases =sum( 'Wn'[Cases#])

 

diff = [wn -1 cases] -[wn cases]

 

Use common person table to display 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

@amitchandak I think is not easy as you said. I need to firstòy construct Columns "I" and "J" dynamically for each person. How I could do that? That's the main question.

I mean, for each row of the Person Table I need to have only the count of the relative amount of cases.

Just to be more clear.

 

Let's take Person A and B example.

In Wn-1 A had 1 case, B had 9 cases
In Wn A had 1 case again, B had 3 cases

I want in total 0 for A and -6 for B which means that A didn't work and B solved 6 cases respect to the previous week. 


Building the columns as you said I will have the total amount of Cases and not divided by person

Anonymous
Not applicable

Hi @robertosangi ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create relationships between Wn, Wn-1 and Person table base on the field Person just as below screenshot

yingyinr_0-1646116496934.png

2. Create two measures as below to get the count of cases in Wn and Wn-1

Wn = COUNT('Wn'[#Case])
Wn-1 = COUNT('Wn-1'[#Case])

3. Create a measure as below to get the difference between Wn and Wn-1

Difference = [Wn]-[Wn-1]

4. Create a table visual as below screenshot

yingyinr_1-1646116652644.png

Best Regards

Thank you. This is what I meant!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors