Forum Discussion

Raj12's avatar
Raj12
Icon for Helper III rankHelper III
2 years ago
Solved

Measure returning value from a connected table ignoring other table selection

Table 1 (LFSLTRNR) has monthly sales for an agent

Table 2 (Agents Target) has monhtly target for an agent.

Table 1 and 2 are connected via agent code

 

Report has Sale date filter from table1 and measure showing agent target for that slected month.

If there is no sale for an agent in a month then their target is coming as blank in the measure, but I want to show target even if there is no sale data in table 1 for an agent i.e. ignoring connection between two table when there is no sale.

 

Measure=

var yrs = SELECTEDVALUE(LFSLTRNR[STRNDT_YEAR])
var mon_start_date =     CALCULATE(Min(LFSLTRNR[STRNDT_Month] ),ALLSELECTEDLFSLTRNR[STRNDT_Month] ))
var mon_end_date =     CALCULATE(MaxLFSLTRNR[STRNDT_Month] ),ALLSELECTED(LFSLTRNR[STRNDT_Month] ))
var agent = SELECTEDVALUE('Team Details (Prop track)'[Sales Code])
return
CALCULATE(SUM('Agents Target'[Value]),
'Agents Target'[Sales Code]=agent,
'Agents Target'[Month]>=mon_start_date && 'Agents Target'[Month]<=mon_end_date && 'Agents Target'[Year]=yrs)

 

4 Replies