Forum Discussion

tejasruparel's avatar
tejasruparel
Frequent Visitor
6 years ago
Solved

Line chart with dynamic values

Hello,

I have a function: f = a + b + c

Let:

abc
050100
151101
252102
353103
454104
555105
656106
757107
858108
959109
1060110

 

I would like to plot (f vs a) or (f vs b) or (f vs c) on a line chart. Where (f vs a) refers to Axis = a and Values = f

The Axis column is selected using a slicer, so Axis = a or b or c

I have three other what if parameters w/ single value slicers for a (slice_a), b (slice_b) and c (slice_c)

 

So, when Axis = a

measure f0 = 0 + slice_b + slice_c

measure f1 = 1 + slice_b + slice_c

measure f2 = 2 + slice_b + slice_c

:

measure f10 = 10 + slice_b + slice_c

 

Essentially, f = a + b + c, where f is calculated for every a (since Axis = a) and values for b and c are obtained from the single value what if slicers. 

 

I use measures to calculate f0 - f10 since these values need to be dynamic depending on Axis and respective single value slicers.

 

I am able to dynamically change the Axis on my line chart (using unpivot), but how can I plot f values to form a single line using f0-f10?

Is there a way I can combine all my measures (f0 - f10) to create a vector/column that would go in Values on the line chart? 

 

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    tejasruparel - I cannot be certain I am following exactly what you are trying to do here. See attached PBIX below signature and see if it is at all close. If not, please explain further. I added an Index column before unpivoting and then wrote this measure:

    f = 
        VAR __a = MAXX(FILTER('Unpivoted',[Attribute]="a"),[Value])
        VAR __Index = MAX('Unpivoted'[Index])
        VAR __b = MAXX(FILTER(ALL('Unpivoted'),[Attribute]="b" && [Index] = __Index),[Value])
        VAR __c = MAXX(FILTER(ALL('Unpivoted'),[Attribute]="c" && [Index] = __Index),[Value])
    RETURN
        __a + __b + __c
    

     

    • tejasruparel's avatar
      tejasruparel
      Frequent Visitor

      Hello Greg_Deckler 

       

      Thanks for your response. 

      Your approach is partly correct. In your approach f = [150, 153, 156 ... 180] for a = [0, 1, 2, ... 10], but I'm not sure how you are picking values for b and c. 

      I want f to be [150, 151, 152 ... 160], so b = 50 and c = 100 (these values should be picked from the single value slicer)

      Please see attached PBIX

       

      I am essentially trying to plot f as a function of a, then be able to update f based on b and c as selected from single value slicer.

       

      Thanks.