Forum Discussion
Comparing day to day
Hello everybody,
following case:
I have the data of multiple Point of Sales. Each day, they get delivered a variety of articles. Let's say newspapers. I know which POS receives which amount of every Article.
On the following day, they receive the new newspaper and the old ones (from the day before which are not sold) are thrown away. This happens every day from Monday to Saturday. So Monday throws away the articles from Saturday, not Sunday.
My goal is, to give an overwiew of the ratio "waste" versus "delivered", so that we can optimize wich article should be placed in which POS with which amount. But i cant even get to display the waste of the nextday with the delivered in one table.
In a Table, with the original Date-Column i tried to use following formula. This works only if dont filter on POS or Article
| Date | ShopID | Article | Amount | Transaktion |
| 01.05.2020 | A123 | Newspaper1 | 3 | delivered |
| 01.05.2020 | B456 | Newspaper2 | 1 | delivered |
| 02.05.2020 | A123 | Newspaper1 | 1 | waste |
| 02.05.2020 | B456 | Newspaper2 | 1 | waste |
| 02.05.2020 | A123 | Newspaper2 | 1 | delivered |
| 02.05.2020 | A123 | Newspaper1 | 1 | delivered |
| 03.05.2020 | B456 | Newspaper1 | 1 | delivered |
| 03.05.2020 | A123 | Newspaper1 | 1 | waste |
| 03.05.2020 | B456 | Newspaper1 | 0 | waste |
Help is much appreciated.
Hi axel_BI ,
We can use the following steps to meet your requirement.
1. Create a calendar table. And create a relationship between two tables.
calendertable = CALENDAR("2020/5/1","2020/6/30")2. We can create four measures.
sum_delivered = CALCULATE(SUM('Transaktions'[Amount]),FILTER('Transaktions','Transaktions'[Transaktion]="delivered"))sum_waste = CALCULATE(SUM('Transaktions'[Amount]),FILTER(Transaktions,'Transaktions'[Transaktion]="waste" ))Sum Waste Following Day = var current_ = MAX(calendertable[Date])+1 return CALCULATE([sum_waste],FILTER(ALL(calendertable),calendertable[Date]=current_))Waste % = DIVIDE([Sum Waste Following Day],[sum_delivered],0)Then we can create a table visual based on the fields in the screenshot.
3. At last we can create three slicers based on calendertable[Date], [shopID] and [Article].
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- Greg_Deckler
Community Champion
So what would be your expected output from that sample data?
- axel_BI
Helper I
Hi Greg,
Something like thisDate ShopID Article Amount Transaktion Waste nextday Waste % 01.05.2020 A123 Newspaper1 3 delivered 1 33,33% 01.05.2020 B456 Newspaper2 1 delivered 1 100,00% 02.05.2020 A123 Newspaper2 1 delivered 0 0,00% 02.05.2020 A123 Newspaper1 1 delivered 1 100,00% 03.05.2020 B456 Newspaper1 1 delivered 0 0,00%
The dream would be to have it aggregated and be abe to drill down on "perDay, per Shop, per Product"
My above formula can only do total delivered, total waste nextday, differentiated by date....if i filter or add hierarchies it stops working
- v-zhenbw-msft
Community Support
Hi axel_BI ,
We can use the following steps to meet your requirement.
1. Create a calendar table. And create a relationship between two tables.
calendertable = CALENDAR("2020/5/1","2020/6/30")2. We can create four measures.
sum_delivered = CALCULATE(SUM('Transaktions'[Amount]),FILTER('Transaktions','Transaktions'[Transaktion]="delivered"))sum_waste = CALCULATE(SUM('Transaktions'[Amount]),FILTER(Transaktions,'Transaktions'[Transaktion]="waste" ))Sum Waste Following Day = var current_ = MAX(calendertable[Date])+1 return CALCULATE([sum_waste],FILTER(ALL(calendertable),calendertable[Date]=current_))Waste % = DIVIDE([Sum Waste Following Day],[sum_delivered],0)Then we can create a table visual based on the fields in the screenshot.
3. At last we can create three slicers based on calendertable[Date], [shopID] and [Article].
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.