Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I have a slight problem…
I have a table of products bought and the corresponding quantities. My goal is to predict (roughly) what will the next quantities I will buy… So I have made a measure that calculate the median of the quantities bought during the previous days to compare with the real value…
I made a simpler model to sort out all this…
The problem is that my measure works well when I consider just one product.
The visual:
The measure:
Solved! Go to Solution.
Hi,@Anonymous
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. Below are the measure I've created for your needs:
Measure =
var cc=CALCULATE(MEDIAN('Apple-Pear'[Quantity]),FILTER(ALLSELECTED('Apple-Pear'),'Apple-Pear'[Label]=MAX('Apple-Pear'[Label])&&'Apple-Pear'[Date]<MAX('Apple-Pear'[Date])))
RETURN IF(cc=BLANK()," ",cc)
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,@Anonymous
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. Below are the measure I've created for your needs:
Measure =
var cc=CALCULATE(MEDIAN('Apple-Pear'[Quantity]),FILTER(ALLSELECTED('Apple-Pear'),'Apple-Pear'[Label]=MAX('Apple-Pear'[Label])&&'Apple-Pear'[Date]<MAX('Apple-Pear'[Date])))
RETURN IF(cc=BLANK()," ",cc)
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It is indeed the results I wanted!
I have yet to understand why it didn’t work with my solution and how it works with yours…
Thank you very much. 🙂
User | Count |
---|---|
15 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
18 | |
13 | |
7 | |
5 |