12-19-2018 02:28 PM
Is it possible to lookup the column header’s name in a calculation.
If I assign the column header a value based on its name, January 2019 could be assigned the value of 1, Feb-19 would be 2 and so forth. This way I can compare a month-year value system to replace values. To further elaborate on my end goal below see the if statement below.
If(Headername = “Jan-19”, 1, 0) or use a switch statement.
Then: if(2>1, 150,0)
With 2 being Feb-19.
12-19-2018 02:32 PM
What is the exact purpose of this can you share some sample and/or example of expected result?
One way would be to do a unpivot of the columns and then make the IF statement on that column, but not really sure what you want to achieve.
12-19-2018 02:38 PM
If we unpivot the data it creates duplicates due to an employee status column. For every month of the year we want to assign a value to it from 1-12 based off the column name. January is 1, February is 2 and so on.
12-19-2018 02:50 PM
Don't understand why you need to do this, can you please elaborate a little better (sorry for insisting).
Each column as a unique name so you can make calculation based on those names and no need to have new names. What I mean is that if you want to calculate the number of people with status Active in February vs January you need to create something like this:
Active Variation = CALCULATE ( COUNT ( Table[Jan-1] ); FILTER ( ALLSELECTED ( Table[Jan-19] ); Table[Jan-19] = "Active" ) ) - CALCULATE ( COUNT ( Table[Jan-1] ); FILTER ( ALLSELECTED ( Table[Feb-19] ); Table[Feb-19] = "Active" ) )
Since I don't know your data and expected result is difficult to give more help but just trying to understand why you need to change the name of the columns.
12-20-2018 06:55 AM
I need to calculate remaining hours each month by contractor over a 1 year period. Subtract hours worked from PO Hours during active contract dates. If a contractor works no hours subtract hours available to work that month. This gives us a burndown of hours in the contract. If the contract hasn't started yet or if the contract has ended, subtract 0.
The problem we are having is that the hours available to work are subtracted before the contract begins and after the contract ends. I originally wanted to use the column headers to look up what month they were so I could assign a numerical value to each Month.Year and compare that to the start and end of each contractors Month.Year.
To elaborate I would look up September 2018 and assign it a 9. If a specific contractor’s contract started in October (9<10) it would not bill any hours for September. This is important because I want to see the total number of hours each contractor will use by month over the year using both a visual and a table.
Using the same contractor as an example if they can work 160 hours in November but they have not submitted their hours yet I would want to use the 160 for the burndown amount unless the hours are submitted.
Data and PBI file examples are below:
Excel Data: https://app.box.com/s/yzg2tjiea7x34gepvjk4dtj1j30kliaj
PBI File: https://app.box.com/s/3yzr3vog8kmljhyftgd3qpgthpzqho3y
12-20-2018 03:11 PM
Not really sure if this is what you need. But please check the PBIX file attached, Iremove all your calculated columns and created 2 measures highlited in green on the table.
However I still think that the best solution would be to unpivot the columns since that would allow you to use time inteligence formulas.
As I said check the two measures I created and if it's expected result if yes I will transform the rest of the data, since it's not yet looking at year and so on.
12-21-2018 10:18 AM
The file you attached is working very well and is almost exactly what I need; thank you so much for the help so far. I very much appreciate it. Besides having the remaining months I need to subtract the amount of workable hours that a contractor could work if their PO was active during that month. When I was originally trying to solve this I was trying to do date comparisons but they would not evaluate properly. Do you have any way to also incorporate this? Just for your information, we will be looking at the data at the contractor level if you have to adjust for that in the calculation.
For example contractor "Last8207, First622"'s PO was active in September but they did not submit any hours. I need to subtract the workable hours for that month and any future months that the PO is active. This amount will vary each month so whatever hours you use in your calculation I could easily adjust.
Please transform the data to look at the year as you offered. If you make any changes to the data let us know what you changed so we can replicate it. I also do not fully understand the calculations that you are using, if you do not mind could you explain it so I can learn for the future?
Thank you again for you help.