Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I've an interesting problem to solve but I need some in order to implement it in PBI with DAX.
I've the following table with several items. These items will always have a price, a currency, a validity date, a suppression code (if this price has been suppressed from the system for any reason) and a source. The table will be something like this (the given example only contains one item but in the real one I can have thousands):
Item | Code | Date 1 | Date 2 | Currency | Value | Value USD | Source |
1 | 01/07/2020 | 01/12/2024 | USD | 18.85 | 18.85 | AB | |
1 | 21/06/2022 | 21/12/2027 | EUR | 9.42 | 10.17 | AB | |
1 | 21/06/2022 | 21/12/2027 | USD | 19.00 | 19.00 | AB | |
1 | A | 14/04/2021 | 14/05/2023 | USD | 6.28 | 6.28 | AC |
1 | 02/04/2020 | 02/12/2023 | USD | 6.28 | 6.28 | AD | |
1 | 01/01/2025 | 31/12/2027 | USD | 7.50 | 7.50 | AD | |
1 | A | 14/04/2021 | 14/05/2023 | USD | 6.70 | 6.70 | AE |
1 | 02/04/2020 | 02/12/2023 | USD | 5.20 | 5.20 | AE |
The idea is to get a final price for each item and for each one of the sources following several rules (with a priority order):
The result table will be something like this:
Item | Value (Source AB) | Valid (Source AB) | Value (Source AC) | Valid (Source AC) | Value (Source AD) | Valid (Source AD) | Value (Source AE) | Valid (Source AC) | Final Value | Dispersion |
1 | 14.59 | Yes | N/A | Code A | 7.5 | Yes | 5.2 | Out of date | 9.42 | Warning |
For each one of the sources, it will get back the average value for the valid lines respecting the previous criteria. The final price will always be selecting respecting the priority order if the source has a valid price (Source AB > Source AC > Source AD).
The column 'Valid (Source XX)' will be -'Yes', 'Code A', 'Out of date'- depending of the case used to compute the price. The last column will indicate that the prices used to calculate the average has a dispersion > 20%.
I'll try to upload my firsts ideas on how to solve it today but I would like to have your suggestions since I know some experts are around here 🙂
Solved! Go to Solution.
Try
Try
It's not compatible with my version of PBI and I cannot install the last one 😞
Hi @capko
can you show tha calculation for the Value (Source AB)?
If i undestrand well it will be the avg of 18,85, 10,17 and 19,00. The valid line for item 1 source AB and the result will be 16,01.
I forgot something?
Why you are show 14,59?
Thank you
Hi ! You're completely right, it has been an error on my side 🙂
User | Count |
---|---|
75 | |
75 | |
45 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |