Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Pmorg73
Post Patron
Post Patron

Filtering and new columns

Hi. Newbie question

 

I have a dataset with lots of job numbers. Some of these are prefixed with a J or a P. Up to now I have been slicing or filtering the visuals with this "starts with" P or J. And that was working great.

 

I now want to do visuals comparing the normal jobs to the prefix ones, ie bar charts of total compared to the P and J jobs.

 

I assume I may need a new column? But how do I then tell PowerBI to select only the values starting with J. I tried calculate but could not get the filter to select all that start with P for example.

 

Thanks

 

Phil

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Pmorg73 

you can write your measure like so:

Measure P = CALCULATE(SUM('Table'[Sales]),FILTER('Table',LEFT('Table'[Product],1)="P"))
Measure J = CALCULATE(SUM('Table'[Sales]),FILTER('Table',LEFT('Table'[Product],1)="J"))
Measure SUM not include P & J =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        'Table',
        LEFT ( 'Table'[Product], 1 ) <> "P"
            && LEFT ( 'Table'[Product], 1 ) <> "J"
    )
)
Measure SUM = SUM('Table'[Sales])

Capture13.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Pmorg73 

you can write your measure like so:

Measure P = CALCULATE(SUM('Table'[Sales]),FILTER('Table',LEFT('Table'[Product],1)="P"))
Measure J = CALCULATE(SUM('Table'[Sales]),FILTER('Table',LEFT('Table'[Product],1)="J"))
Measure SUM not include P & J =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        'Table',
        LEFT ( 'Table'[Product], 1 ) <> "P"
            && LEFT ( 'Table'[Product], 1 ) <> "J"
    )
)
Measure SUM = SUM('Table'[Sales])

Capture13.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks Maggie, perfect. I had deduced I needed the LEFT, but had not yet seen FILTER. Kinda obvious once you see it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors