Forum Discussion
How to duplicate data on day level to week level
- Anonymous4 years ago
Hi jamuka ,
I think your problem should be caused by your relationship between your Date table and Fact Data table. You only have forecast data in the first day of a month. So you could only see forecast values in Week contains these dates.
Here I suggest you to inactive the relationship and create a measure to calcualte Forecast Quantity.
Other values which are calculated by relationship, you can try to create measures by USERELATIONSHIP function.
Date column:
Date = ADDCOLUMNS( CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"Wk","WK"&""&WEEKNUM([Date]))Measure:
Forecast = VAR _ADD = ADDCOLUMNS ( ALL ( 'Table' ), "Year", YEAR ( 'Table'[Forecast Month] ), "Month", MONTH ( 'Table'[Forecast Month] ) ) VAR _SUM = SUMMARIZE ( _ADD, [MATERIAL], [Year], [Month], [Forecast Quantity] ) VAR _GENERATE = GENERATE ( VALUES ( 'Table'[MATERIAL] ), SUMMARIZE ( 'Date', 'Date'[Year], 'Date'[Month], 'Date'[Wk] ) ) VAR _ADD2 = ADDCOLUMNS ( _GENERATE, "Forecast", SUMX ( FILTER ( _SUM, [MATERIAL] = EARLIER ( [MATERIAL] ) && [Year] = EARLIER ( [Year] ) && [Month] = EARLIER ( [Month] ) ), [Forecast Quantity] ) ) RETURN SUMX ( FILTER ( _ADD2, [MATERIAL] = MAX ( 'Table'[MATERIAL] ) && [Month] = MAX ( 'Date'[Month] ) ), [Forecast] )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Anonymous,
thank you it works. But in your file relation is between Date and Forecast Quantity. Shouldn't it be between Date and Forecast Month?
or it doesn't matter because it is an inactive relationship?
regards
Hi jamuka ,
Yes, in my sample, I made a mistake in relationship. As you mentioned the relationship should be between [Date] and [Forecast Month]. It doesn't matter because it is an inactive relationship. Your issue is caused by active relationship between [Date] and [Forecast Month]. Due to the relationship, your will only show WK45(2021/11/01) and WK49(2021/12/01). If we inactive all relationships between two tables, you can get result as you want by measure.
As my above reply, I suggest you to inactive the relationship and create a measure to calcualte Forecast Quantity.
Other values which are calculated by relationship, you can try to create measures by USERELATIONSHIP function.
Could you kindly Accept my reply as a solution if my reply help you solve your problem?
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- jamuka4 years agoHelper IV
Hello Anonymous,
I thougt inactive relationship should be between related fields (e.g date to date) thanks for information.
I did mistakenly accept my answer as solution sorry for that 🙂