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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help with DAX

Hi,

I just have started with DAX, and I would create my first measure, but something is wrong.

I have a comment "cannot find name of column".

Could you explain to me why is that?

 

Kasia654_0-1638650187082.png

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

If you're writing a measure, then you can't refer to a raw column since it doesn't know which values from that column you want are, so you need to use some kind of aggregation.

 

Assuming there actually is a column named STATUS in the table 'EWW 2022', you can write

IF (
    SELECTEDVALUE ( 'EWW 2022'[STATUS] ) = "REALIZACJA",
    SUM ( 'EWW 2022'[TURNOVER] )
)

 

However, the error message associated with the common DAX mistake above is different.

 

Are you sure STATUS is actually a column on 'EWW 2022' and not a different table and that there aren't extra spaces or something similar in the name?

View solution in original post

4 REPLIES 4
bcdobbs
Community Champion
Community Champion

A really good place to start learning is this free video course:

https://www.sqlbi.com/p/introducing-dax-video-course/



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
AlexisOlson
Super User
Super User

If you're writing a measure, then you can't refer to a raw column since it doesn't know which values from that column you want are, so you need to use some kind of aggregation.

 

Assuming there actually is a column named STATUS in the table 'EWW 2022', you can write

IF (
    SELECTEDVALUE ( 'EWW 2022'[STATUS] ) = "REALIZACJA",
    SUM ( 'EWW 2022'[TURNOVER] )
)

 

However, the error message associated with the common DAX mistake above is different.

 

Are you sure STATUS is actually a column on 'EWW 2022' and not a different table and that there aren't extra spaces or something similar in the name?

Anonymous
Not applicable

Thank you so much for your help!
It was exactly what I needed 🙂
I wanted to start with a simple function, and it turned out that it isn't as easy as I thought

Were you trying to sum the turnover column only where the status of each row equaled REALIZACJA?

 

If so I think the following is what you want:

 

 

CALCULATE(
    SUM ( 'EWW 2022'[TURNOVER] ),
    'EWW 2022'[STATUS] = "REALIZACJA"
)

 

 


CALCULATE lets you add a filter in directly (amoungst other things!) rather than relying on a slicer etc.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.