Forum Discussion
DAX: Distinct count - only first consecutive string
- 2 years ago
Hi LABrowne ,
Then this gets a bit tricky. My first suggestion would be to use powerquery if possible. There you could just split via delimiter like this:And now calculate the ids from the new column.
OR:
With dax you could try something like this:Measure 9 =
COUNTROWS( //count the amount of ordersSUMMARIZE( //group the table by orderidsADDCOLUMNS('Table (12)',"A",IF(SEARCH(" ", 'Table (12)'[Column1], 1, 0)> 0,LEFT('Table (12)'[Column1], SEARCH(" ", 'Table (12)'[Column1], 1, 0) - 1),'Table (12)'[Column1])),[A]))
End result:
very simple.
add below column in your table and use that column in your visual:
NewColumn = SUBSTITUTE(SUBSTITUTE(Orders[OrderID], " - cancelled", ""), " - STV", "")
this will replace the ext "- cancelled" and "- STV" with an empty string, effectively removing these parts from the OrderId column. The result is stored in the new column called NewColumn
If this helped, Subscribe AnalyticPulse on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse
https://instagram.com/analytic_pulse
https://analyticpulse.blogspot.com/
subscribe to Youtube channel For fun facts:
https://www.youtube.com/@CogniJourney