Forum Discussion

itsranga's avatar
itsranga
Helper I
9 months ago
Solved

DAX Query Not working

Need to calculate  Parent ticket and child ticket hrs using DAX formula attached image for my requirement i tried multiple ways but its not working

 

  • Hi itsranga 

     

    1. Create Measures:

    Parent_Hrs = SUM(ParentTickets[TotalHrs])
    Child_Hrs = SUM(ChildTickets[TotalHrs])
    Total_By_Ticket =
    VAR _Parent =
        CALCULATE(
            SUM(ParentTickets[TotalHrs]),
            TREATAS(VALUES(ParentTickets[ParentTicketID]), ParentTickets[ParentTicketID])
        )
    VAR _Child =
        CALCULATE(
            SUM(ChildTickets[TotalHrs]),
            TREATAS(VALUES(ParentTickets[ParentTicketID]), ChildTickets[ParentTicketID])
        )
    RETURN
    _Parent + _Child
    

     

    2. Outcome:

     

5 Replies

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi itsranga 

    Thanks for reaching out to the Microsoft fabric community forum. 

     

    I would like to thank you GeraldGEmerick  and rohit1991  for your active participation in the community forum and for the valuable solutions you have shared. Your contributions have a significant impact.

    I hope the information provided will assist you in resolving the issue. If you have further questions or require additional assistance, please do not hesitate to reach out. We are here to support you.

     

    Best Regards, 
    Community Support Team.

  • itsranga How is the Parent ticket tied to the Child Ticket? Is there a table somewhere that defines this relationship or is the data you have exatly what is shown?

  • Hi itsranga 

     

    1. Create Measures:

    Parent_Hrs = SUM(ParentTickets[TotalHrs])
    Child_Hrs = SUM(ChildTickets[TotalHrs])
    Total_By_Ticket =
    VAR _Parent =
        CALCULATE(
            SUM(ParentTickets[TotalHrs]),
            TREATAS(VALUES(ParentTickets[ParentTicketID]), ParentTickets[ParentTicketID])
        )
    VAR _Child =
        CALCULATE(
            SUM(ChildTickets[TotalHrs]),
            TREATAS(VALUES(ParentTickets[ParentTicketID]), ChildTickets[ParentTicketID])
        )
    RETURN
    _Parent + _Child
    

     

    2. Outcome:

     

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi itsranga 

    We have not received a response from you regarding the query and were following up to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

     

    Thank You.