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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Diving two columns from different tables that cannot be summed up

Hi all,

I have a master table for products with their expiry date(in days). For eg 180 days
I have a stocks table for products with their manufacture date.(same products will have different manufacture date)
Now I want to calculate the percentage of expiry( no of days that have passed from maufacture date/no of days that the product is good to use) of each product and manufacture date combination as on today.
Since the columns to be divided are in different table, how do I divide them without summing them up.( Cannot create a measure beacuse that will sum up the values, which is wrong)
Please help
1 ACCEPTED SOLUTION
Cmcmahan
Resident Rockstar
Resident Rockstar

You can totally create a measure, just don't create one that sums up the values.

 

I'm assuming you have some sort of productID that relates from the master table to the stocks table.  

 

Without knowing your table structure, your measure would look something like this:

 

Expiration% =  DATEDIFF(TODAY(), SELECTEDVALUE(Stocks[ManufactureDate]), DAY)/ SELECTEDVALUE(Master[ExpiryLength]) 

Put this in a table with your list of items from the Stocks table, and it should give you correct values.

View solution in original post

2 REPLIES 2
Cmcmahan
Resident Rockstar
Resident Rockstar

You can totally create a measure, just don't create one that sums up the values.

 

I'm assuming you have some sort of productID that relates from the master table to the stocks table.  

 

Without knowing your table structure, your measure would look something like this:

 

Expiration% =  DATEDIFF(TODAY(), SELECTEDVALUE(Stocks[ManufactureDate]), DAY)/ SELECTEDVALUE(Master[ExpiryLength]) 

Put this in a table with your list of items from the Stocks table, and it should give you correct values.

Anonymous
Not applicable

Hi @Cmcmahan 

 

Thanks a lot for the help:) Was struggling with it.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors