Forum Discussion

Bbeckert's avatar
Bbeckert
New Member
2 years ago
Solved

Value Lookup Based on Slicer

I am semi-new to PowerBI. I've managed to teach myself basic features, but am now out of my depth (I am not a developer).    Objective: Generate a cost estimate per sprint for each software develop...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Thank lbendlin
    Hi, Bbeckert 

    Based on your description, I have created these two tables:

    Table1:

    Table2:

    Relationship:

     

    First, I created a numeric range parameter:

    I created two more slicers:

     

    I've created a new measure using the following DAX expression. This measure returns the last date of the user's selected sprint series:

    Measure =   
            VAR _spring = SELECTEDVALUE(Spring[Spring])
    	VAR _team = SELECTEDVALUE(Table2[Team])
    	VAR _date = SELECTEDVALUE(Table1[Dev Start Date])
    	VAR _index = CALCULATE(
    		SELECTEDVALUE(Table1[Sprint Series]),
    		'Table1'[Dev Start Date] = _date
    	)
    	VAR _next_index = IF(
    		_spring = 1,
    		_index,
    		_index + (_spring - 1) * 10
    	)
    	RETURN
    		MAXX(
    			FILTER(
    				ALL('Table1'),
    				'Table1'[Sprint Index] = _next_index
    			),
    			'Table1'[Dev Start Date]
    		)

    I've created another metric to control the display of the corresponding project date:

    Measure 2 = 
            VAR _start = SELECTEDVALUE(Table2[Sprint Start])
    	VAR _end = SELECTEDVALUE(Table2[Sprint End])
    	VAR _spring_1_devdate = IF(
    		SELECTEDVALUE(Spring[Spring]) = 1,
    		SELECTEDVALUE(Table1[Dev Start Date])
    	)
    	RETURN
    		IF(
    			_end = [Measure] || _start = [Measure],
    			1,
    			0
    		)

    Create a table visual as follows:

    Here are the results:

    When I select a sprint, and I select the corresponding team and dev date:

     

    When I choose 2 sprints:

    I've provided the PBIX file used this time below.

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.