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
Luodada
Helper I
Helper I

Caculating FactTable according to the valid date period in BOM table

HI 

 

I have posted this question yesterday , and gotten an answer which partially solved the issue , but I have already marked it as a solution .  so I have reposted it here , and ask for help , I hope it is ok .

 

I have 3 table,  BOM table as below

Item

ProductpcsFrom dateTo date
1550085006893222018-05-012018-05-31
1660075006893242018-05-015999-12-31
1550086987859942018-06-015999-12-31
1660076987859982018-06-015999-12-31
16600716600712018-06-015999-12-31
155055006893232018-06-015999-12-31

 

a Bridgetable

Product
50068932
69878599
166007

 

and a Fact Table

ProductOrder dateOrder

50068932

2018-05-06100
500689322018-05-15200
500689322018-06-15100
500689322018-07-16400

 

I would like to cacuate the [Order] in the FactTable according to the valid date frame in BOM Table

for example >

for  item155008 , product 50068932 ,  I should get order statistics In May 2018 , but NOT in June and July ,as the [to date] in the

BOM Version is expired from 20180531

 

then I have gotten an answer , which is right on the lower level - Product sum level ,  but no figure on aggregated level as below picture ,   anyone knows how to fix it ?

Order Filtered = CALCULATE(SUM(FactTable[Order]), 
                           FILTER(FactTable, 
                                AND(FactTable[Order date] >=  SELECTEDVALUE(BOM[From date]), 
                                    FactTable[Order date] <= SELECTEDVALUE(BOM[To date]))
                                  )
                           )

 

2.jpg

 

here is the example in power BI 

https://drive.google.com/drive/folders/1P8AvsM0E5Ce4N6Aw9sDsFBtWXkl_0wa9

https://drive.google.com/file/d/1zhVRb87pmUbvti2k8rGmYvpA561z3bhK/view?usp=sharing

 

thanks in advance

Luodada

 
 
 
 
 
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi,@Luodada

    You can add this measure as below:

 

Measure = CALCULATE(SUMX(FactTable,[Order according to timeframe]))

Result:

12.PNG

Best Regards,

Lin

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

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi,@Luodada

    You can add this measure as below:

 

Measure = CALCULATE(SUMX(FactTable,[Order according to timeframe]))

Result:

12.PNG

Best Regards,

Lin

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

@v-lili6-msft

 

that is great !

thanks Lin !

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.