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.
Hi there community!
I'm working with a dataset in which I'm trying to display on Customer and Article level the sales Amount. This is done by looking at a set of seperate Excel files all with their own date of uploading (represented by File Date). These seperate files are combined in to one query by using the append queries function, and File Date functions as an identifying column to be able to differentiate between the seperate files that have been combined in to one query.
I have built a small dataset to give an idea on what kind of data I'm working with:
CustomerDelivery DateArticleAmountFile Date
1 | 23-10-2021 | 999 | 100 | 1-1-2022 |
1 | 12-12-2021 | 999 | 500 | 1-2-2022 |
1 | 30-12-2021 | 212 | 400 | 1-3-2022 |
1 | 15-1-2022 | 487 | 150 | 1-3-2022 |
1 | 18-3-2022 | 212 | 300 | 1-4-2022 |
2 | 12-12-2021 | 476 | 300 | 1-1-2022 |
2 | 23-5-2022 | 98 | 1000 | 1-2-2022 |
2 | 25-5-2022 | 146 | 20 | 1-2-2022 |
2 | 30-7-2022 | 999 | 500 | 1-3-2022 |
2 | 5-8-2022 | 358 | 700 | 1-5-2022 |
2 | 10-10-2022 | 487 | 100 | 1-4-2022 |
3 | 15-11-2021 | 564 | 500 | 1-1-2022 |
3 | 30-1-2022 | 999 | 400 | 1-3-2022 |
3 | 2-2-2022 | 154 | 50 | 1-3-2022 |
3 | 24-7-2022 | 308 | 800 | 1-5-2022 |
The data will be presented to the user in a matrix similar to the one below:
The user will be expanding this matrix to also get a detailed view on Article level, which would look something like this:
Using the matrices presented above I want to be able to compare values and show the differences. If Customer = 1 this would mean that the first matrix should also show the following values:
Ideally this difference is shown in percentages but to get it calculated in absolute numbers is a start. I have been struggling with this for a while now and I'm reaching out for suggestions as to how I can get a measure/column implemented to reach the desired result.
Looking forward to your suggestions and many thanks in advance!
Solved! Go to Solution.
Hi @hassaanb_ ,
Please try:
% (Customer level) =
var _nextDate= MINX(FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])&& [File Date]>MAX('Table'[File Date])),[File Date])
var _diff=CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'), [Customer]=MAX('Table'[Customer]) &&[File Date]=_nextDate ))-SUM('Table'[Amount])
return DIVIDE(_diff,SUM('Table'[Amount]))
Or
% (Article level) =
var _nextDate= MINX(FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article]) && [File Date]>MAX('Table'[File Date])),[File Date])
var _nextSum=CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'), [Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article])&&[File Date]=_nextDate ))
var _current=CALCULATE(SUM('Table'[Amount]),FILTER('Table', [Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article])))
return DIVIDE( _nextSum-_current, _current)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @hassaanb_ ,
Please try:
% (Customer level) =
var _nextDate= MINX(FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])&& [File Date]>MAX('Table'[File Date])),[File Date])
var _diff=CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'), [Customer]=MAX('Table'[Customer]) &&[File Date]=_nextDate ))-SUM('Table'[Amount])
return DIVIDE(_diff,SUM('Table'[Amount]))
Or
% (Article level) =
var _nextDate= MINX(FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article]) && [File Date]>MAX('Table'[File Date])),[File Date])
var _nextSum=CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'), [Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article])&&[File Date]=_nextDate ))
var _current=CALCULATE(SUM('Table'[Amount]),FILTER('Table', [Customer]=MAX('Table'[Customer])&&[Article]=MAX('Table'[Article])))
return DIVIDE( _nextSum-_current, _current)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
113 | |
97 | |
79 | |
73 | |
56 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |