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
ricod
Helper I
Helper I

powerBi in and out

Hello

 

i've a folder with xslx files containing cat and dog names. i want from 1st september 2024 calculate the variation of placements. i've tried many thinks with date table or not but i'm not able to do it specially when i filter with type (dog or cat)

 

can you help ?

 

xlsx file(s)

typearrivaldeparture
dog01/01/202502/01/2025
cat01/01/202501/02/2025
dog02/01/202502/02/2025
dog02/01/202502/02/2025
dog04/01/2025 
dog04/01/2025 
dog04/01/2025 
dog04/01/2025 
dog03/01/202403/02/2025
dog03/01/202403/02/2025

 

output expected (with possibility to filter on type cat, dog, ... ) :

dateINOUTvariation
Jan. 2025211
feb. 2025230
mar. 202502-2
apr. 2025402

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @ricod ,

 

For this you need to have a disconnected table to do the context of the date.

 

Add a calendar table to your model and the also add the folllowing measures:

Arrivals = COUNTROWS(FILTER('Table', 'Table'[arrival] <= MAX('Calendar'[Date]) && 'Table'[arrival] >= MIN('Calendar'[Date])))

Departures = COUNTROWS(FILTER('Table', 'Table'[departure] <= MAX('Calendar'[Date]) && 'Table'[departure] >= MIN('Calendar'[Date]) && 'Table'[departure]<> BLANK()))

variation = [Arrivals]  - [Departures]

 

MFelix_0-1738681352478.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @ricod ,

 

For this you need to have a disconnected table to do the context of the date.

 

Add a calendar table to your model and the also add the folllowing measures:

Arrivals = COUNTROWS(FILTER('Table', 'Table'[arrival] <= MAX('Calendar'[Date]) && 'Table'[arrival] >= MIN('Calendar'[Date])))

Departures = COUNTROWS(FILTER('Table', 'Table'[departure] <= MAX('Calendar'[Date]) && 'Table'[departure] >= MIN('Calendar'[Date]) && 'Table'[departure]<> BLANK()))

variation = [Arrivals]  - [Departures]

 

MFelix_0-1738681352478.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



yes but when i filter on dog or cat, the calculation is wrong :'(

 

Hi @ricod ,

 

On the test I did the values are correct:

MFelix_0-1738684297915.pngMFelix_1-1738686790362.png

 

Since we are doing a filter on the table the cat and dog will be taken from the filter and the calculation must be correct, except if you have any other context impacting this.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



hi,

 

the calcul is not the expected :

 

ricod_0-1738766368894.png

 

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