The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
HI,
Prologue:
I am new to Power BI but have some experience from writing formulas in Excel. For some parts of this PBI-report i have used ChatGPT with success, but perhaps without the deeper understanding of why it works 🙂 Since im on a trial and error here, basically all calculated columns has a sibling in a measure, to see which one that works. Formulas that starts with 1=measures and 2=columns.
Purpose:
Im building a database that has the purpose to detect customers whos claims are deviating from the average based on last 8 weeks data
Data structure:
All data is basically bundled up in one table and a row of data is based on a specific day, customer, article and reason code (either sale or specific claims code (ex. damaged goods))
The table contains the columns (and alot more but not perhaps relevant to the case):
Customer Number
claims amount
sales amount
Date and Week
Sales category bases on sales per week
followed by
Claims/sales for single store > Claims/sales for all stores in that category*factor = 1/0
"
Claims in amount exceeds a threshold for that category = 1/0
Both rules = 1, 1/0
Note: I changed all formulas from BLANK() -> 0 from here on out, to be able to visualize the result.
The formulas add up in regards of a single stores claims/sales, as well as the total for that stores sales category. The formulas also work in regards of one store exceeding both claims in amount and regarding claimed/sales in comparison to sales category. When visualizing this, first to evaluate if the rules add up (same store for all rows down below):
Same store but now only with both rules = 1 (called checkfactor in the report), and by week
Now the part i need your help with. I want to create a measure that compiles/sums up all those =1 for "checkfactor" for the last 8 weeks and either give me a = Yes if the count of these are more than 5 in the last 8 weeks, or simply just a sum. If my last image had the right filter (last 8 weeks) i basically would like the total in the image but in a separate measure. The total has to be per customer and a week can only render 1/0, not per row, day other something else.
Any ideas?
Thanks in advance!
Solved! Go to Solution.
Solved it by creating a relative week calendar and calculated each week individually and then summed it up.
Solved it by creating a relative week calendar and calculated each week individually and then summed it up.
I have gotten this far which limits the period but unfortunately i get 1, even though only one week is 1 rather than 5 times last 8 weeks.
User | Count |
---|---|
12 | |
9 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
14 | |
9 | |
7 |