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
Anonymous
Not applicable

Measure return 1 if year, 4 if quarter...

I need to calculate annualized revenue per full time employee and I'm having trouble getting the integar based on the time frame. I'm trying to write a measure so that I get a 1 if it's grouped by year, 4 if by quarter, and 12 if by month. I have attached a visual of what I hope the output will look like.

 

 

Time frame output.JPG

Thanks.

2 ACCEPTED SOLUTIONS

Try something like this

 Annualized Revenue per FTE =
 var Annualization =if(ISFILTERED('Date'[QTR Year]),4,12)
 return
  DIVIDE([Total Revenue], [FTEs]) * Annualization

 

Also refer: https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

 

 

View solution in original post

Anonymous
Not applicable

I got it! Made a sligt tweak to your initial measure. Thanks so much!

 

Annualization = 
IF(ISINSCOPE('Date Table'[MonthInCalendar]), 12,
    IF(ISINSCOPE('Date Table'[QuarterInCalendar]),4,
        IF(ISINSCOPE('Date Table'[Year]), 1, BLANK()
        )
    )
)

 

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks.
Proud to be a Datanaut My Recent Blog -Time Intelligence - Direct Query

Anonymous
Not applicable

Let's say I'm tying to calculate annualized revenue per full time eployee on a quarterly basis. I'd use:

Total Revenue = SUM('Revenue'[Revenue])
FTEs = SUM('HR'[Full Time Employees])

Annualization = ? (the measure I'm trying to figure out)

 

Where the final measure looks like:

 

Annualized Revenue per FTE = DIVIDE([Total Revenue], [FTEs]) * Annualization

 

There is a relationship between the dates in the Revenue and HR table to my calendar table so when I group it by quarter, those numbers will adjust accordingly. What I need is for the annualization measure to adjust as well so that is returns 4 if grouped by quarter and 12 if it's by month. I hope that helps. Thanks!

Try something like this

 Annualized Revenue per FTE =
 var Annualization =if(ISFILTERED('Date'[QTR Year]),4,12)
 return
  DIVIDE([Total Revenue], [FTEs]) * Annualization

 

Also refer: https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

 

 

Anonymous
Not applicable

That's very close! The only issue is that if I expand all levels it returns a 4 for month and quarter.

Time frame output.JPG

Hmm. Let us give preference and test. You can try the same with if.

 

Switch(true(),
ISFILTERED(Table[Month-Year]),12,
ISFILTERED(Table[Qtr-Year]),4,
1
)
Anonymous
Not applicable

I got it! Made a sligt tweak to your initial measure. Thanks so much!

 

Annualization = 
IF(ISINSCOPE('Date Table'[MonthInCalendar]), 12,
    IF(ISINSCOPE('Date Table'[QuarterInCalendar]),4,
        IF(ISINSCOPE('Date Table'[Year]), 1, BLANK()
        )
    )
)

 

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.