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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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