sparkwoodand21
New Member
- Joined
- Nov 17, 2005
- Messages
- 15
Hello,
I'm fairly new to PowerQuery but enjoying the process of learning and seeing the obvious benefits it will bring.
I have an immediate situation that is beyond my understanding currently and from reviewing past questions/answers it appears to be new:
I'm running monthly absence reports that 'can' contain up to 40 columns of absence types along with other columns of data. The report only shows those columns containing data each month. So only a selection of the the 40 absence columns available will appear.
I'm using PowerQuery to unpivot the absence report (from a matrix type layout - work shifts on the rows and absence types in columns) into a more normalized structure for loading into a table within a SQL database - which then feeds a dashboard in PowerBI.
So, from:
Date Shift Abs1 Abs2 Abs3 etc.
jan 1 A 3 0 2
to:
Date Shift AbsType AbsValue
Jan 1 A 1 3
Jan 1 A 3 2
etc.
The load to SQL needs to include a column that sums a fixed 25 of the 40 columns to calculate an employed total. Not all the 25 columns will be present each month, but most will.
My thinking was to 'add' the missing columns into PowerQuery for each monthly report so the employed total formula in PowerQuery is static and therefore can always reference the 25 columns it requires. Where a missing column is added it will contain only zero values.
The end of the query filters out all zero values so the missing columns will be excluded from the data loaded to SQL.
I may not be coming at this from the correct angle, but hopefully I've explained the situation sufficiently for understanding.
Any guidance would be appreciated.
Regards,
John
I'm using O365
I'm fairly new to PowerQuery but enjoying the process of learning and seeing the obvious benefits it will bring.
I have an immediate situation that is beyond my understanding currently and from reviewing past questions/answers it appears to be new:
I'm running monthly absence reports that 'can' contain up to 40 columns of absence types along with other columns of data. The report only shows those columns containing data each month. So only a selection of the the 40 absence columns available will appear.
I'm using PowerQuery to unpivot the absence report (from a matrix type layout - work shifts on the rows and absence types in columns) into a more normalized structure for loading into a table within a SQL database - which then feeds a dashboard in PowerBI.
So, from:
Date Shift Abs1 Abs2 Abs3 etc.
jan 1 A 3 0 2
to:
Date Shift AbsType AbsValue
Jan 1 A 1 3
Jan 1 A 3 2
etc.
The load to SQL needs to include a column that sums a fixed 25 of the 40 columns to calculate an employed total. Not all the 25 columns will be present each month, but most will.
My thinking was to 'add' the missing columns into PowerQuery for each monthly report so the employed total formula in PowerQuery is static and therefore can always reference the 25 columns it requires. Where a missing column is added it will contain only zero values.
The end of the query filters out all zero values so the missing columns will be excluded from the data loaded to SQL.
I may not be coming at this from the correct angle, but hopefully I've explained the situation sufficiently for understanding.
Any guidance would be appreciated.
Regards,
John
I'm using O365