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

Variation Column

Hello!

 

Var headcount.jpg

QP Var.jpg

 

I need to create a new column in "Variação" (variation in english) table, called "Var Headcount" in which the 1st row is:

 

[nr of rows with 'domingo, 1 de Maio de 2016' associated in 'QP' table] - [nr of rows with 'sexta-feira, 1 de Abril de 2016' associated in 'QP' table]

 

2nd row:

 

[nr of rows with 'sexta-feira, 1 de Abril de 2016' associated in 'QP' table] - [nr of rows with 'terça-feira, 1 de Março de 2016' associated in 'QP' table]

 

and so on...

 

How can i do this?

 

Thanks!

1 ACCEPTED SOLUTION
sornavoor
Resolver I
Resolver I

Please see the below if it works for you.... 

 

2 Steps:  

 

Step 1 Count of related rows as a column in Date Table:

QP Row Count = IF(COUNTROWS(RELATEDTABLE(QP))>0,COUNTROWS(RELATEDTABLE(QP)), 0)

 

Step 2: Difference in Count from Prior Month:

 

Difference From Prior Month = 'Date Table'[QP Row Count] - CALCULATE(SUM('Date Table'[QP Row Count]),DATEADD('Date Table'[Date],-1,MONTH))

 

 

 


Data ModelData ModelQP TableQP Table

Step 1 - Add a Related Row Count ColumnStep 1 - Add a Related Row Count ColumnStep 2 - Add  a Difference in Row Count from prior MonthStep 2 - Add a Difference in Row Count from prior Month

View solution in original post

2 REPLIES 2
sornavoor
Resolver I
Resolver I

Please see the below if it works for you.... 

 

2 Steps:  

 

Step 1 Count of related rows as a column in Date Table:

QP Row Count = IF(COUNTROWS(RELATEDTABLE(QP))>0,COUNTROWS(RELATEDTABLE(QP)), 0)

 

Step 2: Difference in Count from Prior Month:

 

Difference From Prior Month = 'Date Table'[QP Row Count] - CALCULATE(SUM('Date Table'[QP Row Count]),DATEADD('Date Table'[Date],-1,MONTH))

 

 

 


Data ModelData ModelQP TableQP Table

Step 1 - Add a Related Row Count ColumnStep 1 - Add a Related Row Count ColumnStep 2 - Add  a Difference in Row Count from prior MonthStep 2 - Add a Difference in Row Count from prior Month

Worked perfectly!!!

 

Thanks a lot @sornavoor 🙂

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