Forum Discussion
Data Shaping Help?
DangerDraper , if you do not have Single column to join. You can create concatenated column and jin them
Key = [Column1] & "-" & [Column2]
For between dates refer if this can help : https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
thanks amitchandak but there's issues with that, probably based upon my lack of description. The calendar table is already dynamically created (see MyCal in post).
To visualise it better, the root data set (DefectData) looks like this:
| Plant | DefectStart | DefectEnd |
| Plant N1 | 01-01-2001 | 04-01-2001 |
| ... | ... | ... |
The calendar table (MyCal) is generated off two querries, as described earlier:
| CalDate |
| 01-01-2001 |
| ... |
| 28-10-2017 |
Back to (DefectData), pivoting off the (Plant) column will change the data to either of these two tables:
| DefectStart | Plant N1 | .... | Plant N4 |
| 01-01-2001 | 1 | ... | 0 |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
| 02-10-2017 | 0 | .... | 1 |
Or
| DefectEnd | Plant N1 | .... | Plant N4 |
| 03-01-2001 | 1 | ... | 0 |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
| 30-10-2017 | 0 | .... | 1 |
For sanity sake, i create and save them both as (DefectStartTable) and (DefectEndTable).
The desired end is to construct the following:
| CalDate | Plant N1 | ... | Plant N4 |
| 01-01-2001 | 1 | ... | 0 |
| 02-01-2001 | 1 | ... | 0 |
| ... | ... | ... | |
| 28-10-2017 | 0 | ... | 1 |
| 29-10-2017 | 0 | ... | 1 |
| 30-10-2017 | 0 | ... | 1 |
From there, the visualisation aspects are fine. It more a matter of how do I transform the data natively within PowerBI without resorting to pre-transforming it in the original source. The real trick is how do I create a positive response for dates between a defect (ie. 29-10-2017), other wise the visualisation won't know to join the start/end dates.
I initially tried the root data (DefectData) as a gantt visual but the successive defects cascaded down the visual as seperate instances and not reoccurring instaces against the (Plant).
Hope that this better explains the dilema.