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
arashaga
Helper I
Helper I

My Columns do not show up in the DAX editor

I am trying to do a little switch statement such as

 

Switch([Institution] , "A", "1","B",2 ....)

 

but after switch statement DAX does not recognize my columns where it usually pop up with intelisene and even when I type it it cannot recognize the columns. However it only recognizes the measure that I created previously. I would like to know what I am doing wrong here. Thanks

1 ACCEPTED SOLUTION

Hi @arashaga,

 

You want to make such a Switch statement via a measure, right? Is [institution] a field name?

 

Please try this

Measure =
SWITCH (
    SELECTEDVALUE ( Table1[institution] ),
    "A", CALCULATE (
        COUNT ( Table1[Column] ),
        FILTER ( ALL ( Table1 ), Table1[Column] = "G" )
    ),
    "B", CALCULATE (
        COUNT ( Table1[Column] ),
        FILTER ( ALL ( Table1 ), Table1[Column] = "K" )
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

6 REPLIES 6
Anonymous
Not applicable

In your case, you are trying to create a measure with SWITCH statement and hence DAX suggests only measures.

 

If you create this as calculated column, you will see the option of columns as well.

 

Thanks
Raj

How do you use switch with calculate?

Anonymous
Not applicable

If you could post some sample data and expeced output, would be easy to suggest .

 

If needed , you can use the IF or SWITCH in the filter with logic.

Thanks

Raj

I would like to do the following calculation. I am trying to compare one institution with it's peer institution.

For instance compare A with G and B with K. Also,

I will most likely have some other filters in the page so I would like to igonre some of them as well.

 

if institution = "A"
then ignore all the filters and give me the total attendance for institution G
if institution = "B"
then ignore all the filters and give me the total attendance for institution K

 

I hope this would help to describe what I need to do.

Hi @arashaga,

 

You want to make such a Switch statement via a measure, right? Is [institution] a field name?

 

Please try this

Measure =
SWITCH (
    SELECTEDVALUE ( Table1[institution] ),
    "A", CALCULATE (
        COUNT ( Table1[Column] ),
        FILTER ( ALL ( Table1 ), Table1[Column] = "G" )
    ),
    "B", CALCULATE (
        COUNT ( Table1[Column] ),
        FILTER ( ALL ( Table1 ), Table1[Column] = "K" )
    )
)

Best regards,

Yuliana Gu

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

Excellent solution thank you.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.