Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I'm trying to calculate the last year sales dynamically based off of the dates selected on the slicer. Within my date dimension table, each calendar date has a corresponding last year date. I've created a measure to do that:
pbi_Net_Sales_Total_LY_old = CALCULATE(sum(Merch[net_amt]), filter(all('Merch'), Merch[trans_dt] = VALUES('Calendar'[CALENDAR_DT_LY])))
This works fine if only one value has been selected, as shown below.
When more than one value has been selected, it throws a multiple value error message.
My approach is capturing the last year dates that are based off of the dates selected on the slicer and passing them into the filter in my measure so that it will only sum the sales that has a transaction date that equals to the last year dates that I'm passing. Seems like "Merch[trans_dt] =" doesn't like mulitple values and VALUES('Calendar'[CALENDAR_DT_LY]) containing multiple values is not helping. Is there anyway I can make the filter accept multiple values, in my case a column that contains multiple values? Or, is my approach the correct way of doing this?
Here's an extremely simiplified version of what my data model looks like:
If this matters, the data model is actually in Analysis Services, not in Power Bi.
Hi @Anonymous
I think the easiest way would be to have a relationship between Calendar[CALENDAR_DT_LY] and [trans_dt]. By doing that the slicer would filter Merch directly. Is that possible?
If you already have another active relationship between those two tables you can always creative an additional inactive one and activate it within the measure through USERELATIONSHIP.
Bumping this back up because my last edit removed all my images and formating. Also realized that it did not include enough context to make things clear, added more information to my original post.
User | Count |
---|---|
65 | |
60 | |
47 | |
33 | |
32 |
User | Count |
---|---|
86 | |
75 | |
56 | |
50 | |
45 |