Forum Discussion

ecs70206's avatar
ecs70206
Regular Visitor
9 years ago

dax help with division

hi community

 

 

I need to ask for your help, i have to find out what the spend per passenger is o  my most recent project. I know i need a new calculated column but i dont know how to make the dax work...i am trying to learn but DAX is really HARD :-)

 

At the moment this is my situation. Ive brought three tables in and created a reference key for the routes. the table in the chart on

the report canvas as shown in the picture shows the spend and the number of passengers on each route alongside the route number. i need to create a column that divides the spend by route by the passenger number to find the spend by passenger by route but i dont know how

 

on my second table i have a column called code. this is linked to the route key on a many to many relationship. each route can take passengers that have different codes I also need to find out the cost per pupil by code.

 

i know this is alot ..but im bamboozled ... i've put as many pictures as i can in to show my situation , any help would be amazing

 

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    What you likely want are measures, not calculated columns. So, in the first example, you could create a measure like:

     

    SpendPerPassenger = SUM([Spend]) / SUM([Passengers])

    If you put this measure into your visual, it will be evaluated in context, which means within the context of each row. 

     

    For the rest of it, sample data would help but this should get you started down the right path.

    • ecs70206's avatar
      ecs70206
      Regular Visitor

      thank you ,

       

      I'll give that a go and let you know 

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Microsoft Employee

        Hi ecs70206,

         

        Could you please tell me if your problem was resolved? Could you please share the answer or mark the proper answer as solution if it's convenient for you? That will be a help to the others.

        Best Regards!
        Dale