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
This IF condition is hardcoded for 'Hourly conversion'. I tried to avoid this code and used a DAX expression instead, but it caused a circular dependency error. Please correct the error
That was the only way to avoid getting the 586 total also in the last row which also has blank Parent Ticket
I do not find your code, though, where is it? In your message I only see my code
- itsranga1 year agoHelper I
Measure = VAR CurrentID = SELECTEDVALUE ( Table[Ticketno] ) RETURN CALCULATE ( SUM ( Table[Hours] ), Table[Parent Ticket] = CurrentID )FBergamaschi i tried using this measure
- FBergamaschi1 year agoSuper User
This code cannot work as a measure
Measure =VAR CurrentID = SELECTEDVALUE ( Tabella[Ticket no] )RETURNCALCULATE (SUM ( Tabella[Total Hrs] ),Tabella[Parent Ticket] = CurrentID)My code was for a column. The point is that the last row has an empty Parent Ticket like the first one so how do we make the difference? I wroteColonna =IF ( ISBLANK( Tabella[Parent Ticket] ) && Tabella[Summary ] <> "Hourly Conversion", SUMX ( FILTER ( Tabella, NOT ISBLANK( Tabella[Parent Ticket] ) ), Tabella[Total Hrs] ) )but if you prefer you can useColonna =IF ( ISBLANK( Tabella[Parent Ticket] ) && Tabella[Summary ] = "Data Conversion", SUMX ( FILTER ( Tabella, NOT ISBLANK( Tabella[Parent Ticket] ) ), Tabella[Total Hrs] ) )and it will work as you were asking? We can avoid the hardwire if you specify another way to identify the last row vs the first oneBut now I ask you: do you need a column or a measure? To me, you need a column but of course please let me know otherwiseIf 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