Forum Discussion
Need Help - DAX Code
- 1 year ago
This is very simple but in your original data it was not like this, here is the table you showed
Anyway I adjusted the data and now I have the following
and now I have what you want without any hardwiring:
Test =VAR Ticket = Tabella[Ticket No]RETURNSUMX ( FILTER ( Tabella, Tabella[Parent Ticket] = Ticket ), Tabella[Total Hrs] )The above is a columnIf you want a measure, let me knowIf this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your threadWant to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi itsranga ,
Thanks for sharing the detailed process you’ve explained it quite well, and your approach is absolutely correct. Just to confirm, once you load your data into Power BI from Excel or your relevant source, you can go ahead and create the "Relevant Hrs" calculated column in the Data view.
The DAX expression you've mentioned works fine it checks if the Parent Ticket is not blank and then uses CALCULATE with ALLEXCEPT to sum the Total Hrs grouped by Parent Ticket. If the Parent Ticket is blank, it rightly returns a blank value. After that, adding the fields like Ticket No, Summary, Parent Ticket, Total Hrs, and the newly created Relevant Hrs into a Table visual in Report view is the right way to go.
Based on your example, if multiple rows share the same Parent Ticket, the Relevant Hrs should show the correct total, like 586 for the Data Conversion case, while entries without a Parent Ticket (like Hourly Conversion) will show blank, which is expected. You can also apply conditional formatting or adjust the column widths to improve readability. Once everything looks good, saving the report and publishing it to the Power BI Service is the final step.
Please feel free to text me back if you have any questions
I’ve attached the .pbix file and screen shorts used in this test for your reference.
Thank you.
Tejaswi.
v-tejrama thanks for your suppot, somewhat okay i slightly changed the formula it's okay but
This is a parent-child ticket concept. For example, one parent ticket can have multiple child tickets. I need to display in a new column, show the sum of all the child ticket hours.
In this case, ticket number 1043930 is the parent ticket (row 1), and rows 3 and 4 are its child tickets. So, I need to calculate the sum of hours where the ticket number matches the parent ticket, and display that sum in the parent ticket's row
- FBergamaschi1 year agoSuper User
This is very simple but in your original data it was not like this, here is the table you showed
Anyway I adjusted the data and now I have the following
and now I have what you want without any hardwiring:
Test =VAR Ticket = Tabella[Ticket No]RETURNSUMX ( FILTER ( Tabella, Tabella[Parent Ticket] = Ticket ), Tabella[Total Hrs] )The above is a columnIf you want a measure, let me knowIf this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your threadWant to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- v-tejrama1 year agoCommunity Support
Hi itsranga ,
Thank you FBergamaschi for the helpful input!
Were you able to resolve the issue? If the response addressed your query, kindly confirm. This helps keep the community informed and improves solution visibility.
Thank you for your support!