Forum Discussion
mterry
7 years agoHelper V
DAX for monthly data with missing values
I have output data for several locations spanning multiple years (a portion of the data is attached). Some locations have consistent output throughout the year, some will have a change at one point d...
- 7 years ago
hi, mterry
Based on my research, you could try this way:
Step1:
Create a dim year month date table or you could just use this formula to create a new dim table
Dim Date = SELECTCOLUMNS ( FILTER ( CALENDAR ( "2018-01-01", "2019-12-31" ), DAY ( [Date] ) = 1 ), "Year No", YEAR ( [Date] ), "Month No", MONTH ( [Date] ), "Year Month", YEAR ( [Date] ) * 100 + MONTH ( [Date] ) )Step2:
Add month column for date column in your basic table
Step3:
Use this formula to create a new table
Table = FILTER(GENERATE(Basic,'Dim Date'),Basic[Year]='Dim Date'[Year No])
Step4:
In the new table, create a real outout column
Real Output = IF('Table'[Month]<='Table'[Month No],'Table'[Ending Output],'Table'[Beginning Output])Step5:
Drag Year month column and real output column from the new table into a visual
Result:
Here is sample pbix file, please try it.
Best Regards,
Lin
v-lili6-msft
7 years agoCommunity Support
hi, mterry
Yes, you'd better create a year-month date dim table as above, that will make the solution easier to understand.
Best Regards,
Lin
mterry
7 years agoHelper V
Thanks for the help