Forum Discussion
Total value for last 6 months.
Hi ,
6 month delivered total value =
VAR Last6Months = DATESINPERIOD('Calendar'[Date], LASTDATE('Calendar'[Date]), -6, MONTH)
RETURN
SUMX( VALUES(DMT_HCP_PERSONA_NEW[HCP_PERSONA_HCP_MDM_ID]), CALCULATE( [Delivered total value], Last6Months ) )
if i used above measure it give the below result
| HCP_ID | Jul | Aug | Sep | Oct | Nov | Dec | Total |
| 5 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 10 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 12 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
| 24 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
i need the total value for last 6 months based on id.below is my sample requirement result.
| HCP_ID | Jul | Aug | Sep | Oct | Nov | Dec | Total |
| 5 | 1 | 1 | 1 | 1 | 1 | 1 | 6 |
| 10 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
| 12 | 0 | 0 | 1 | 1 | 0 | 1 | 3 |
| 24 | 1 | 1 | 1 | 1 | 1 | 1 | 6 |
i need a total value for each id.but its give the total value is 1 for each id.please give the correct one.
thanks,
Vidya
like this?
- First I have taged my facts with 1 or 0 (calculated column)
- then I used this formula:CALCULATE( SUM(yourFactTable[Tag-column]), FILTER( yourFactTable, 1), DATESINPERIOD(DimDate[Date], MAX(DimDate[Date]), -6, MONTH))
Hope you got the idea.
Regards
4 Replies
- Vidya1882Frequent Visitor
Hi sergej_og
Delivered total value = if(sum(DMT_HCP_PERSONA_NEW[DELIVERED]) >= 1 , 1,0)
if i use above this measure its give total 1 or 0.it not give the row of total value .for example: DMT_HCP_PERSONA_NEW[DELIVERED] is 65 for id 5 for july month, so this is greater than 1 right ,so it return 1 otherwise 0.same method for all months.in this case for all months value is 1 for 5 id .it should be total is 6.but it give the 1. need exact value is aboveHCP_ID Jul Aug Sep Oct Nov Dec Total 5 1 1 1 1 1 1 6 10 1 0 0 1 0 0 2 12 0 0 1 1 0 1 3 24 1 1 1 1 1 1 6 - sergej_og
Super User
like this?
- First I have taged my facts with 1 or 0 (calculated column)
- then I used this formula:CALCULATE( SUM(yourFactTable[Tag-column]), FILTER( yourFactTable, 1), DATESINPERIOD(DimDate[Date], MAX(DimDate[Date]), -6, MONTH))
Hope you got the idea.
Regards