March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I'm stuck with a problem and hope soemone here can help me out. I treid to simplify the setup to point out the issue.
I have a lookup table containign Advertiser / Campaing /start and end date
The data table only has Advertiser date and value. My goal is to get the Values per live campaign (data date is in between start and end lookup date).
My idea was to have a a calculated column in the data table indicating whether the line is belonging to a "live" campaign (0/1)It would be soemthing like this in in the filed.
Lookup corrospondind Advertiser in th lookup table, check whether date is within start and end dates, if yes 1 if no check for next line with corrosponding advertiser, cehck dates ...
But I was not able to get the proper DAX. Any ideas? I'm open to other solution as well.
Thanks
Solved! Go to Solution.
Hi @jasi,
You can create a measure in Lookup Table below. See attched .pbix.
Measure = CALCULATE(SUM('Data Table'[Value]),FILTER('Data Table',MAX('Lookup Table'[Advertiser])='Data Table'[Advertiser] && MAX('Lookup Table'[End Date])>='Data Table'[Date] && MAX('Lookup Table'[Start Date])<='Data Table'[Date]))
Best Regards,
Qiuyun Yu
SO assuming i understand what you wanting..
the data table you want to add in the Campaign column based on the advertiser and date?
make a new calculated column in the data table that does this:
Campaign =
IF ( 'lookup table'[Advertiser] = 'data table'[Advertiser] & 'data table'[Date] >= 'lookup table'[Start Date] &
'data table'[Date] <= 'lookup table'[End Date],
'lookup table'[Campaign],
blank()
)
then you can just create a measure to count value total
Total = count(value total)
then make a table on the report, drag in campaign, advertiser, total
Thanks for your help, but it is not to working for me.
I get the error already when PBI should compare the Advertiser fields. It is not doing the many to many compare.
IF ( 'lookup table'[Advertiser] = 'data table'[Advertiser] ,0,1)
"This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max"
Any other idea?
Hi @jasi,
You can create a measure in Lookup Table below. See attched .pbix.
Measure = CALCULATE(SUM('Data Table'[Value]),FILTER('Data Table',MAX('Lookup Table'[Advertiser])='Data Table'[Advertiser] && MAX('Lookup Table'[End Date])>='Data Table'[Date] && MAX('Lookup Table'[Start Date])<='Data Table'[Date]))
Best Regards,
Qiuyun Yu
Thanks a lot @v-qiuyu-msft
This is working out fine for this example. I was able to recreate it.
I will now try to apply your solution to the more complex live data!
cheers
jasi
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |