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
csalinas23
Helper II
Helper II

Create a column based on a measure

Dear

I need to create the following column "instock ? If ( Stock > ? (Sell/14), 1, 0)"

The problem is that the stock is ready in Table 1, but the sale is made based on a measure in Table 2, which is as follows:

Sale s/he/he/he
CALCULATE(
[TOTAL_SO_UNIDADES],
DATESBETWEEN(SELLOUT[Dates],
DATEADD(LASTDATE(SELLOUT[Fechas]),-13,DAY),
LASTDATE(SELLOUT[Dates])
))
The question is, how can I create that column as a result of that measure? I've tried, but it throws error.



I'm staying tuned

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@csalinas23 ,Not very clear.

 

You can have a new column in the stock table like

Sumx(filter(Sales,[sales[item id] = stock[item Id] && Sales[Date] >= max(sales[date])-13),sales[TOTAL_SO_UNIDADES])

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share some data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

SO 14D = SUMX(RELATEDTABLE(SELLOUT), DATESBETWEEN(SELLOUT[Fechas], DATEADD(LASTDATE(SELLOUT[Fechas]),-13,DAY), LASTDATE(SELLOUT[Fechas])))
amitchandak
Super User
Super User

@csalinas23 ,Not very clear.

 

You can have a new column in the stock table like

Sumx(filter(Sales,[sales[item id] = stock[item Id] && Sales[Date] >= max(sales[date])-13),sales[TOTAL_SO_UNIDADES])

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.