Active Member
December 12, 2020
Hi,
I am new to the forum so thank you in advance for answering my question.
I made a power pivot and I would like to add a measure to calculate the number of days between two dates.
I manage to try various options but nothing works.
On a regular excel I will use the following: =IF(OR(ISBLANK([@[Profile Received]]),ISBLANK([@[Earliest Start Date]])), "",[@[Earliest Start Date]]-[@[Profile Received]])
Inside my power pivot, I tried the following:
=SWITCH(TRUE(),'Data source'[Earliest Start Date]<'Data source'[Profile Received],-1*DATEDIFF('Data source'[Earliest Start Date],'Data source'[Profile Received],DAY),'Data source'[Earliest Start Date],'Data source'[Profile Received], DATEDIFF('Data source'[Profile Received],'Data source'[Earliest Start Date], DAY),0)
but following error messages Calculation error in measure 'Data source'[measure 1]: A single value for column 'Profile Received' in table 'Data source' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
I am not sure if I am correct or not and what type of aggregation to use.
Thanks for your help
Alexandra
July 16, 2010
Hi Alexandra,
Welcome to our forum!
It looks like you're writing a measure, when comparing to your Excel forumula, what you actually want to write is a calculated column?'
=SWITCH(TRUE(),'Data source'[Earliest Start Date]<'Data source'[Profile Received],-1*DATEDIFF('Data source'[Earliest Start Date],'Data source'[Profile Received],DAY),'Data source'[Earliest Start Date],'Data source'[Profile Received], DATEDIFF('Data source'[Profile Received],'Data source'[Earliest Start Date], DAY),0)
If you do intend to write a measure, then the section in red is most likely the issue because you're comparing a whole column of values to another whole column, when you need to return a single value. e.g.
MIN('Data source'[Earliest Start Date])<MIN('Data source'[Profile Received])
That said, I'm not sure without seeing your file. If you can share a sample file with an extract of your data and an example of your desired result, we can help you further.
Mynda
Active Member
December 12, 2020
Hi Mynda,
I attached my sample file.
I want to answer some question as, how long it took once we receive the profile and when the person started and also the turnover by role type.
I have some blank in my file that my issue and I need to work around.
Thank for the help.
Alexandra
July 16, 2010
Hi Alexandra,
Your example isn't clear, sorry. You have a PivotTable in the file, but I don't know what you're wanting to see specifically. You mention 'when a person started' but the PivotTable is at the Status level, not the staff member level.
Please provide a mockup example of your desired result and show how it relates back to the sample data. This will allow us to follow the audit trial to correctly understand what you want to do.
Thanks,
Mynda
Active Member
December 12, 2020
Hi Mynda,
I think I am lost because I would like to do a Dashboard with my Data.
I watched all your videos and I created some Dashboard in the past but on this one, I am blocked.
I am trying to answer various questions but not sure how to handle it correctly mainly the turnover.
What is the turnover, per type, per Role?
How to calculate the turnover, directly from the pivot with a measure or in the Power query editor.
Thanks for your guidelines
Alexandra
July 16, 2010
Hi Alexandra,
Have you seen my HR Dashboard tutorial which covers how to calculate turnover using Power Pivot, which is where you should be calculating this information, as opposed to Power Query?
Mynda
1 Guest(s)