Forum Discussion
Line graph 6 months backward based on Dropdown selection
- 2 years ago
Hi,
You may refer to my solution in the attached PBI file.
Hope this helps.
- 2 years ago
pls ignore i manage to find a solution
i created another measure
Inbound =VAR __END_DATE_WEEK =MAXX(ALLSELECTED('Dates(Disconnected)W'),'Dates(Disconnected)W'[End of Week])VAR __END_DATE_MONTH =MAXX(ALLSELECTED('Dates(Disconnected)M'),'Dates(Disconnected)M'[End of Month])RETURNIF(ISFILTERED('Dates(Disconnected)W'[End of Week]),CALCULATE(DISTINCTCOUNT(RECEIPT_CONTAINER[CONTAINER_ID]),FILTER(RECEIPT_CONTAINER,RECEIPT_CONTAINER[End of Week] = __END_DATE_WEEK)),IF(ISFILTERED('Dates(Disconnected)M'[End of Month]),CALCULATE(DISTINCTCOUNT(RECEIPT_CONTAINER[CONTAINER_ID]),FILTER(RECEIPT_CONTAINER,RECEIPT_CONTAINER[End of Month] = __END_DATE_MONTH)),DISTINCTCOUNT(RECEIPT_CONTAINER[CONTAINER_ID])))
Hi vinodDrinkPak ,
You need to create disconnected dates table to reference in your measure. If you don't, the visual will show the dates within the range selected from the slicer. The disconnected dates table doesn't have a relationship to the fact table and can be created either in DAX, M or enter data. You will then need to create a measure that references the date selected from the disconnected table.
Sample measure:
Inbound2 =
VAR __END_DATE =
MAX ( 'Dates(Disconnected)'[End of Month] )
VAR __START_DATE =
EDATE ( __END_DATE, - 6 )
RETURN
CALCULATE (
DISTINCTCOUNT ( RECEIPT_CONTAINER[CONTAINER_ID] ),
FILTER (
RECEIPT_CONTAINER,
RECEIPT_CONTAINER[End of Month] >= __START_DATE
&& RECEIPT_CONTAINER[End of Month] <= __END_DATE
)
)
Please refer to the attached pbix.
- vinodDrinkPak2 years agoHelper II
its so cool, can you help me with the End of Week dropdown as well. thank so much, you are a savior
looks like its broken the dropdown
- vinodDrinkPak2 years agoHelper II
danextian i replicated your formula for End of week
Inbound Week =VAR __END_DATE =MAX ( 'Dates(Disconnected)W'[End of Week])VAR __START_DATE =EDATE ( __END_DATE, - 6 )RETURNCALCULATE (DISTINCTCOUNT ( RECEIPT_CONTAINER[CONTAINER_ID] ),FILTER (RECEIPT_CONTAINER,RECEIPT_CONTAINER[End of Week] >= __START_DATE&& RECEIPT_CONTAINER[End of Week] <= __END_DATE))the problem is it doesn't restrict the view to last 6 weeks, rather it shows up everything- danextian2 years agoSuper User
EDATE function is for adding to or subracting x months from a date. The variable below is equivalent to selected date - 6 months.
VAR __START_DATE = EDATE ( __END_DATE, - 6 )Use this instead
VAR __START_DATE = __END_DATE - ( 6 * 7 )