Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I'm having trouble with a calculated column. I am trying to see sales data 3 weeks prior and post-visitation to a store so I can compare with the week that the store is visited.
I have the formula in a calculated column below, which matches the sales data store number & week number to that of the store visitation export (I just add a +1 or -1 to change the week number for pre- and post-visitation weeks).
Solved! Go to Solution.
Hi @rexeubank
The claculated column can't be changed by the other table's filter. I believe you can achieve this by changing it to the measure as below:
Measure = SUMX(
FILTER(
ALLSELECTED('Sales'),
AND(
'Sales'[Week Number] = MAX('Combined Recaps'[WM Week]),
'Sales'[Store Number] = MAX('Combined Recaps'[Retail ID])
)
),
'Sales'[Sales]
)
@rexeubank , refer my post on week can help you
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
example
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
@rexeubank - Yeah, you need to use an aggregator around your column references in a measure. Hard to be more specific, Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
I apologize for the vagueness. Maybe this can help:
Below is my data.
On the top, I have the visitation export (what stores were visited and when). This is where the calculated columns are located.
On the bottom is the sales data. I match the week numbers and the store numbers (Retail ID/Store Number) and sum the sales data based on those two criteria.
And the calculated column code for easier viewing.
I need to get the weekly sales into a format where I can filter them by the Brand & Type from the Sales tab.
Current Week =
SUMX(
FILTER(
'Sales',
AND(
'Sales'[Week Number] = 'Combined Recaps'[WM Week],
'Sales'[Store Number] = 'Combined Recaps'[Retail ID]
)
),
'Sales'[Sales]
)
Hi @rexeubank
The claculated column can't be changed by the other table's filter. I believe you can achieve this by changing it to the measure as below:
Measure = SUMX(
FILTER(
ALLSELECTED('Sales'),
AND(
'Sales'[Week Number] = MAX('Combined Recaps'[WM Week]),
'Sales'[Store Number] = MAX('Combined Recaps'[Retail ID])
)
),
'Sales'[Sales]
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |