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
admin_xlsior
Post Prodigy
Post Prodigy

Average of COUNTROW

Hi,

 

How to allocate some value (lets say Yearly Target), equally thorugh Quarters or Months ?

 

Firstly, I have my Target Table:

YearTarget
2019670

 

 Then I have my Measures to allocate this like below:

Target Value = SUMX(
VALUES('Date'[Year]),
COUNTROWS('Date') / CALCULATE(COUNTROWS('Date'),ALLEXCEPT('Date', 'Date'[Year])) * CALCULATE( SUM(ProductivityTarget[Target]), FILTER(ALL(ProductivityTarget[Year]), ProductivityTarget[Year] = 'Date'[Year])))
 
Because it actually counting days of my Date table, it will gave me like this :
image.png
As picture above, the Value is not the same because they count the days per quarters which is not the same. This is also happening if add Months :
image.png
I am thinking about to Average it, but I don know where to start and how. Or whether it is the correct way to have a fixed allocation factor ?
 
Thanks in advance.
 
 
 
 
 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi admin_xlsior,

According to your description, my understanding is that you want to get the data divided averagely by the months, in your scenario, the data should be 55.8 for all months.

We can first create three calculated columns on the Date table using the following query:

Month = CONCATENATE( FORMAT('Date'[Date],"MMMM")," " &FORMAT('Date'[Date],"YYYY"))

Quarter = "Quarter" &" "& FORMAT('Date'[Date],"Q")&","&'Date'[Date].[Year]

Monthnumber = MONTH('Date'[Date])

 

aaa.png

Then sort the Month column by Monthnumber:

bbb.png

 

After that, we can create a measure like below:

Target Value = DIVIDE(SUM(ProductivityTarget[Target]),12)*CALCULATE(DISTINCTCOUNT('Date'[Month]),FILTER('Date','Date'[Year] = MIN(ProductivityTarget[Year])))

Drag the Month, Quarter and Target Value column to table visual, the result will like below:

ccc.png

Please refer to the following pbix file

https://1drv.ms/u/s!Ao9Of0JgO6MU7WB5_jwWjrCQCQYw  

 

Best Regards,

Teige

View solution in original post

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

Hi admin_xlsior,

According to your description, my understanding is that you want to get the data divided averagely by the months, in your scenario, the data should be 55.8 for all months.

We can first create three calculated columns on the Date table using the following query:

Month = CONCATENATE( FORMAT('Date'[Date],"MMMM")," " &FORMAT('Date'[Date],"YYYY"))

Quarter = "Quarter" &" "& FORMAT('Date'[Date],"Q")&","&'Date'[Date].[Year]

Monthnumber = MONTH('Date'[Date])

 

aaa.png

Then sort the Month column by Monthnumber:

bbb.png

 

After that, we can create a measure like below:

Target Value = DIVIDE(SUM(ProductivityTarget[Target]),12)*CALCULATE(DISTINCTCOUNT('Date'[Month]),FILTER('Date','Date'[Year] = MIN(ProductivityTarget[Year])))

Drag the Month, Quarter and Target Value column to table visual, the result will like below:

ccc.png

Please refer to the following pbix file

https://1drv.ms/u/s!Ao9Of0JgO6MU7WB5_jwWjrCQCQYw  

 

Best Regards,

Teige

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.