Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there, I have an OrderTable,
With Orders[OrderId] and I have multiple orders uploaded, see below example:
123-456
123-456 - Cancelled
123-456 - STW
Now on the system this counts total orders as 3, which is correct there is 3 orders on the system.
Is there any way to write a dax formula that ignore any characters (inc. space) and only count the first consecutive string? So that the above order count would be 1 if that makes sense.
Any help would be great!
Solved! Go to Solution.
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:
Proud to be a Super User!
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
Hi,
If your order id has a consistent amount of characters here is one way to do this:
If your orderids have different lenghts ping me with "@" and I will revise the dax.
Proud to be a Super User!
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:
Proud to be a Super User!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |