cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
null
Helper V
Helper V

DAX calculation or table with context

Hi, I want to create a line chart with multiple lines, here is the origin data

so the data should be transformed to this:

dim            value_a   value_b value_c 
6-30    10                  3         4
31-60   20                 5          7
>60      2                 9          23

I am new to use DAX, how can I create calculation or table use DAX to create these columns(dim, value a b c) and consider context with post_man, grade?

Thank you.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@null , create a common dimension with these values 6-30days, 31-60days, etc

 

Join with three columns dim_a, dim_b, dim_c , Two joins will be inactive and you can activate it using userelationship in a measure

 

example

calculate(count(Table[dim_b], userelationship(Table[Dim_b], dim[dim]) )

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@null , create a common dimension with these values 6-30days, 31-60days, etc

 

Join with three columns dim_a, dim_b, dim_c , Two joins will be inactive and you can activate it using userelationship in a measure

 

example

calculate(count(Table[dim_b], userelationship(Table[Dim_b], dim[dim]) )

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

@amitchandak Thank you. Do you mean join three column is to build relationship between two tables? But  it's unable to bulit relationship of 3 columns with another column.

If the relation is inactive, can it still calculation the real value with these3 calculation? as I use these calculations as value-axis and dimension table as the x-axis to make up a multiple line chart

Tried it, works well

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors