Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi guys,
Apologies if this is answered elsewhere- I'm continuing to research but keep finding solutions that don't quite work, and I'm not yet experienced enough to figure out how and why they're not working.
Basically, I have a record of transactions: people accessing software and the date on which they accessed it. On a separate table, I have "contracts." This table includes the company name, software name, and the start and end date of the product's contract. I need to be able to match these individual transactions to which contract they belong to so I can do other transformations. Basically, I'm looking to create a custom column in the transaction table that gives the index number of the contract. This is basically to account for the fact that the transaction records have no link to the contracts. x.x
In order to find out which contract the transaction belongs to, I need to look at the transaction's company name, software name, and the date of the transaction. I want to look up the contracts table and return the index number of the contract that has a matching company name, software name, and... fits within the contract period. That's been tricky.
So for example, John Smith from Cool Company used Software A on 12/4/2022. I'd like to lookup the contracts, see which contract matches "Cool Company," Software A, and the right start and end date (say it was the contract from 3/1/2022-3/1/2023), and return that index number.
Thanks!
Solved! Go to Solution.
@ChelseaCL
You can do it as a calculated column on the Transations table, or as a measure (with a couple variations). A measure should be easier on the model (less space, faster) but if you want to build the relationship between the tables based on that index information then you will have to go with calc column. You could probably do something similar in Power Query too. I think only Measure Variant 2 will work if there are overlapping contracts for same company/software.
Calc column on Transations:
Respectfully,
Zoe Douglas (DataZoe)
Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/
Hi,
Share data in a format that can be pasted in an MS Excel file and show the expected result.
@ChelseaCL
You can do it as a calculated column on the Transations table, or as a measure (with a couple variations). A measure should be easier on the model (less space, faster) but if you want to build the relationship between the tables based on that index information then you will have to go with calc column. You could probably do something similar in Power Query too. I think only Measure Variant 2 will work if there are overlapping contracts for same company/software.
Calc column on Transations:
Respectfully,
Zoe Douglas (DataZoe)
Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/
Thanks! I think I'll need to make a new post in the m query section to refine this (sorry, didn't realize it was different,) but this got me started in the right direction.
Apologies, I apparently did not understand the difference between a "calculated" column and a "computed" column. I was trying to put this in as a custom column in the transform screen and eventually figured out why it wasn't working. I think it would be best to have this as a Power Query computed column, though? Both because I need this index value present for other tables to use and because I think the data is better set up for it. Currently trying to figure out how to convert it to Power Query.
This is what I've got so far. Still trying to parse the M rules.
_startdate =
LOOKUPVALUE (
'Assets Grouped'[Usage_Start_Date__c],
'Assets Grouped'[Account.Name], 'Transactions by Contract Year'[CompanyName],
'Assets Grouped'[ProductName], 'Transactions by Contract Year'[ProductName],
)
_enddate =
LOOKUPVALUE (
'Assets Grouped'[UsageEndDate],
'Assets Grouped'[Account.Name], 'Transactions by Contract Year'[CompanyName],
'Assets Grouped'[ProductName], 'Transactions by Contract Year'[ProductName],
)
_indates = [Accessed] >= _startdate
&& [Accessed] <= _enddate,
_indexnumber =
LOOKUPVALUE (
'Assets Grouped'[Index],
'Assets Grouped'[Account.Name], 'Transactions by Contract Year'[CompanyName],
'Assets Grouped'[ProductName], 'Transactions by Contract Year'[ProductName],
'Assets Grouped'[Usage_Start_Date__c], _startdate,
'Assets Grouped'[UsageEndDate], _enddate,
)
RETURN
IF ( _indates, _indexnumber, BLANK () )
Thanks very much! I'm trying this out and will let you know how it goes. I think I do need the calculated column.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
97 | |
65 | |
45 | |
39 | |
31 |
User | Count |
---|---|
164 | |
111 | |
61 | |
53 | |
38 |