Itay
That looks very interesting and I will work with that to see where it leads.
What if instead of a User Principal I want to return data based on a campaign Id. That is, I'm not interested in the current user as much as I am the current campaign. A user can have many campaigns but I'm only interested in one campaign at a time.
For example, the Kusto stored function I am using from PBI might look like:
.create-or-alter function with (docstring = 'blah', folder='-de-blah')
MyFunction(campaignId:long) // Note the parameters passed in from PBI
{
let advertisers = (campaignId:long) {
Advertisers
| where CampaignId == campaignId
| project name;
};
mytable
| where TvcAdvertiserName in (advertisers(campaignId))
}
But currently I have no way of passing the campaignId in dynamically from Power BI embedded.
When I started thinking this through I thought what I needed was a function like the following, similar to how MS Analysis Services works:
.create-or-alter function with (docstring = 'blah', folder='-de-blah')
MyFunction() // No parameter this time
{
let campaignId = <MagicCustomDataKustoFunction()>; // Value passed through securely from EffectiveIdentity instance when running as embedded
let advertisers = (campaignId:long) {
Advertisers
| where CampaignId == campaignId
| project name;
};
mytable
| where TvcAdvertiserName in (advertisers(campaignId));
}
What you're suggesting won't allow me to perform additional lookups as shown in my examples above. Your suggestion depends on PBI adding additional 'where' clauses to columns that are not in the data set coming back.
I feel like I'm just approaching this from the wrong angle.
James