Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tejasruparel
Frequent Visitor

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? 

 

1 ACCEPTED SOLUTION
tejasruparel
Frequent Visitor

4 REPLIES 4
tejasruparel
Frequent Visitor

See attached PBIX

Greg_Deckler
Super User
Super User

@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

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hey @Greg_Deckler , did you get a chance to look at the PBIX I attached?

 

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.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.