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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
lboldrino
Resolver I
Resolver I

How can i multiple columns from Different tables With Condition other Cols

TicketCosts

from   to          year     cost

2503502019166,05
3514502019158,51
4515502019150,96
5516502019143,41
6501000002019135,86
2503502020168,54
3514502020160,89
4515502020153,22
5516502020145,56
6501000002020137,9

 

tblTotalticket

Closed MonthYearTotal Tickets
2020.032020288
2020.042020286
2020.052020227
2020.082020201
2020.062020205
2020.012020403
2020.072020260
2020.022020260
2019.042019350
2019.062019234
2019.072019220
2019.082019251
2019.112019429
2019.012019401
2019.052019270
2019.022019241
2019.102019295
2019.122019374
2019.092019203
2019.032019264

 

i need the cost per month where totalTickets beween from /to

2019.01 : if year = 2019 and total tickets between 250 and 350 then Totalcost = 401 *166,05 

tblTotalticket is a summerize Table !!!!! (

Customer_TicketPreis =
SUMMARIZE ( customer_tmp, [Closed Month],customer_tmp[Year], "Total Tickets", SUM(customer_tmp[TicketsAnzahl]))

)

 

ThanX for Your Ideas! 🙂

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @lboldrino ,

 

Please check if this is what you want:

Column =
VAR Cost_ =
    CALCULATE (
        SUM ( TicketCosts[cost] ),
        FILTER (
            TicketCosts,
            TicketCosts[year] = tblTotalticket[Year]
                && TicketCosts[from] <= tblTotalticket[Total Tickets]
                && TicketCosts[to] >= tblTotalticket[Total Tickets]
        )
    )
RETURN
    [Total Tickets] * Cost_

column_.PNG

 

 

Best Regards,

Icey

 

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

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @lboldrino ,

 

Please check if this is what you want:

Column =
VAR Cost_ =
    CALCULATE (
        SUM ( TicketCosts[cost] ),
        FILTER (
            TicketCosts,
            TicketCosts[year] = tblTotalticket[Year]
                && TicketCosts[from] <= tblTotalticket[Total Tickets]
                && TicketCosts[to] >= tblTotalticket[Total Tickets]
        )
    )
RETURN
    [Total Tickets] * Cost_

column_.PNG

 

 

Best Regards,

Icey

 

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

Pragati11
Super User
Super User

Hi @lboldrino ,

 

You will need to have a relatioship between these 2 tables on a common column.

Have you got any relationship?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

i create a Floag col in Ticketcosts:

 

2503502019166,05 €1
3514502019158,51 €2
4515502019150,96 €3
5516502019143,41 €4
6501000002019135,86 €5
2503502020168,54 €6
3514502020160,89 €7
4515502020153,22 €8
5516502020145,56 €9
6501000002020137,90 €10

 

and in customer_totaltickets: Flag =
switch(
true(),
customer_TicketPreis[Total Tickets] >249 && customer_TicketPreis[Total Tickets] < 351 && customer_TicketPreis[Year]= 2019,1
,customer_TicketPreis[Total Tickets] >350 && customer_TicketPreis[Total Tickets] < 451 && customer_TicketPreis[Year]= 2019,2
,customer_TicketPreis[Total Tickets] >450 && customer_TicketPreis[Total Tickets] < 551 && customer_TicketPreis[Year]= 2019,3
,customer_TicketPreis[Total Tickets] >550 && customer_TicketPreis[Total Tickets] < 651 && customer_TicketPreis[Year]= 2019,4
,customer_TicketPreis[Total Tickets] >650 && customer_TicketPreis[Total Tickets] < 100000 && customer_TicketPreis[Year]= 2019,5
,customer_TicketPreis[Total Tickets] >350 && customer_TicketPreis[Total Tickets] < 451 && customer_TicketPreis[Year]= 2020,7
,customer_TicketPreis[Total Tickets] >450 && customer_TicketPreis[Total Tickets] < 551 && customer_TicketPreis[Year]= 2020,8
,customer_TicketPreis[Total Tickets] >550 && customer_TicketPreis[Total Tickets] < 651 && customer_TicketPreis[Year]= 2020,9
,customer_TicketPreis[Total Tickets] >650 && customer_TicketPreis[Total Tickets] < 100000 && customer_TicketPreis[Year]= 2020,10
,customer_TicketPreis[Total Tickets] >249 && customer_TicketPreis[Total Tickets] < 351 && customer_TicketPreis[Year]= 2020,6
,99)

 

Closed MonthYearTotal TicketsFlag

2020.0320202886
2020.0420202866
2020.05202022799
2020.08202020199
2020.06202020599
2020.0120204037
2020.0720202606
2020.0220202606
2019.0420193501
2019.06201923499
2019.07201922099
2019.0820192511
2019.1120194292
2019.0120194012
2019.0520192701
2019.02201924199
2019.1020192951
2019.1220193742
2019.09201920399
2019.0320192641

 

This works, do you have a better idea for

customer_totaltickets: Flag =
switch(
true(),
customer_TicketPreis[Total Tickets] >249 && customer_TicketPreis[Total Tickets] < 351 && customer_TicketPreis[Year]= 2019,1
,customer_TicketPreis[Total Tickets] >350 && customer_TicketPreis[Total Tickets] < 451 && customer_TicketPreis[Year]= 2019,2
,customer_TicketPreis[Total Tickets] >450 && customer_TicketPreis[Total Tickets] < 551 && customer_TicketPreis[Year]= 2019,3
,customer_TicketPreis[Total Tickets] >550 && customer_TicketPreis[Total Tickets] < 651 && customer_TicketPreis[Year]= 2019,4
,customer_TicketPreis[Total Tickets] >650 && customer_TicketPreis[Total Tickets] < 100000 && customer_TicketPreis[Year]= 2019,5
,customer_TicketPreis[Total Tickets] >350 && customer_TicketPreis[Total Tickets] < 451 && customer_TicketPreis[Year]= 2020,7
,customer_TicketPreis[Total Tickets] >450 && customer_TicketPreis[Total Tickets] < 551 && customer_TicketPreis[Year]= 2020,8
,customer_TicketPreis[Total Tickets] >550 && customer_TicketPreis[Total Tickets] < 651 && customer_TicketPreis[Year]= 2020,9
,customer_TicketPreis[Total Tickets] >650 && customer_TicketPreis[Total Tickets] < 100000 && customer_TicketPreis[Year]= 2020,10
,customer_TicketPreis[Total Tickets] >249 && customer_TicketPreis[Total Tickets] < 351 && customer_TicketPreis[Year]= 2020,6
,99)

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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