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
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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors