Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello there
New to PowerBI and trying to pick it up as a go along building a dashboard that will save me time every day.
I am trying to create a new column in my main data table that is based on a date and matching it to values in a different table.
For example:
Machine usage
| Users PIN | Date of use |
| 2468 | 02/10/2017 |
| 2468 | 20/01/2018 |
| 3098 | 05/02/2018 |
| 2568 | 15/01/2018 |
| 2568 | 20/01/2018 |
Subscription history
| Users PIN | Subscription | Subscription Start date | Subscription End Date |
| 2468 | Bronze | 01/10/2017 | 25/11/2017 |
| 2468 | Silver | 25/11/2017 | 15/01/2018 |
| 2468 | Gold | 15/01/2018 | 15/01/2019 |
| 3098 | Gold | 20/10/2017 | 02/02/2018 |
| 3098 | Bronze | 02/02/2018 | 02/02/2019 |
| 2568 | Silver | 01/01/2018 | 10/01/2018 |
| 2568 | Bronze | 10/01/2018 | 10/01/2019 |
What I am looking to do is to add to the machine usage table the details of the subscription that was active at the time of use, eg:
| Users PIN | Date of use | Subscription | Subscription Start date | Subscription End Date |
| 2468 | 02/10/2017 | Bronze | 01/10/2017 | 25/11/2017 |
| 2468 | 20/01/2018 | Gold | 15/01/2018 | 15/01/2019 |
| 3098 | 05/02/2018 | Bronze | 02/02/2018 | 02/02/2019 |
| 2568 | 15/01/2018 | Bronze | 10/01/2018 | 10/01/2019 |
| 2568 | 20/01/2018 | Bronze | 10/01/2018 | 10/01/2019 |
I am going to carry on reading and watching training videos - but right now I am not sure where and how best to achieve this.
Many thanks in advance.
Andy
Solved! Go to Solution.
You can use the same pattern as above to get the other columns you want for example
Subscription Start Date =
CALCULATE (
FIRSTNONBLANK ( SubscriptionHistory[Subscription Start date], 1 ),
FILTER (
SubscriptionHistory,
MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
&& MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
&& MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
)
)
That looks to do exactly what I wanted, thank you for your help. Now I am going to spend an hour making sure I understand how this works 🙂
Thanks
Andy
Hi @AndyT9
Try this Calculated Column....
Subscription =
CALCULATE (
FIRSTNONBLANK ( SubscriptionHistory[Subscription], 1 ),
FILTER (
SubscriptionHistory,
MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
&& MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
&& MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
)
)
You can use the same pattern as above to get the other columns you want for example
Subscription Start Date =
CALCULATE (
FIRSTNONBLANK ( SubscriptionHistory[Subscription Start date], 1 ),
FILTER (
SubscriptionHistory,
MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
&& MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
&& MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
)
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |