Forum Discussion
Measure for hide months without data
- 10 years ago
Thanks everyone.
This dax show me until i have the data, not based in data but in time and I resolved.
CALCULATE(DIVIDE([Data1];[Data2]);FILTER('DIM TIEMPO';'DIM TIEMPO'[AÑO] >= YEAR(NOW()) -1);'DIM TIEMPO'[NUMERO DE MES] < MONTH(NOW()))
Thanks again and all your replies are in my knowledge.
1. I am assuming you have a date table with no gaps.
2. I am also assuming you have a MonthNumber column in the Date table which is Month(Datetable[DateField])
3. Create a Measure called CurYrLastMonthNumber = Month(Lastdate(Sales[Date]))
This will find the lastdate of from the sales table and get the corresponding Month Number for it.
4. Create a column in Date table called Show as
ShowMonthsUpto = IF (
[MonthNumber] <= [CurYrLastMonthNumber] , 1, 0
)
5. Show will have a value of 0 or 1 in the date table.
6. Assume you have a measure called [Sales] that calculates the sum of Sales . As per your requirment I am assuming your sales records contains future predicted sales.
7. Create a bar chart where x-axis is Month and Y- axis is Sales measure.
8. In the visual level filter for the bar chart drag the field ShowMonthsUpto and set the filter condition show items when the value is 1.
9. You will then be able to see the Sales for the same period for both years. Months after the lastmonth in the sales for previous year will not be shown.
10. The above solution assumes you will always be showing for the current year and previous in the chart / report.
Should you require further assistance , please do not hesitate to reply to this post.
If this works for you please accept it as a solution and also give kudos.
Thanks everyone.
This dax show me until i have the data, not based in data but in time and I resolved.
CALCULATE(DIVIDE([Data1];[Data2]);FILTER('DIM TIEMPO';'DIM TIEMPO'[AÑO] >= YEAR(NOW()) -1);'DIM TIEMPO'[NUMERO DE MES] < MONTH(NOW()))
Thanks everyone again.