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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.