Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
GuiBrum
Frequent Visitor

Last record before slicer

I have a table with production calculating the cost of each production batch.

Another table showing the sales price of said products.

The visualization should show the average sales price, the average cost and calculate the profit.

When I set the visualization slicer to show 2020 for example, if I sold the material this year but produced last year, the visualization will not find the cost and show 100% profit.

 

table example below:

Production Table  
BatchDateProductCost
1Oct-19A $       0.83
2Oct-19B $       0.88
3Nov-19A $       0.81
4Nov-19B $       0.86
5Dec-19A $       0.82
6Jan-20B $       0.85
7Feb-20B $       0.89
8Mar-20B $       0.83
9Apr-20B $       0.83
10May-20B $       0.90
11Jun-20B $       0.84

 

Sales Table   
DateProductPricethe slicer does not find cost for product AMargin
Dec-19A $       1.18 $       0.82 $       0.36
Jan-20A $       1.20 $           -   $       1.20
Jan-20B $       1.19 $       0.85 $       0.34
Feb-20B $       1.19 $       0.89 $       0.30
Mar-20B $       1.19 $       0.83 $       0.36
Apr-20B $       1.19 $       0.83 $       0.36
Apr-20A $       1.20 $           -   $       1.20
May-20B $       1.19 $       0.90 $       0.29
Jun-20B $       1.19 $       0.84 $       0.35

 

Thank you for any help in this direction

4 REPLIES 4
V-pazhen-msft
Community Support
Community Support

@GuiBrum 

I see the problem. However, I am confused with your example tables, what i can think of is you may relate the tables by related the batches columns, and then create a slicer with Date column. But I cannot see the relationship and the calendar of your model.

 

Please provide a sample pbix including the relationship and calendar, so we can test and find a solution for you.


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@GuiBrum , I am not able to figure out the logic you have for price in a month . But I would have created a calculated column to get the price in the sales table. preferably use date in place on the month

City Name = maxx(FILTER(geography,geography[City Id]=Sales[City Id]),geography[City]) 
Month Name = LOOKUPVALUE('date'[Month Year],'date'[Date],Sales[Sales Date]) 

 

You can add remove condition as per need

 

The month and year on the table are really examples, the actual information is Date.

The problem is that the date slicer is handling the sales date correctly, but it is not picking up the production cost if the material was made before the slicer cut off.

Hello, the product price is sales price (for each customer) so it is not calculated.

the batch cost is calculated within Power Query, the tables are available from power query (it has much more than only the columns I show - these seem to be the relevant columns).

I tried to be concise on the question. Here is my model

GuiBrum_0-1592922779600.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.