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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Kolumam
Post Prodigy
Post Prodigy

Filter for Calculated column

Hi All,

 

In the below table, Y1, Y2.....Y6, Cumulative are calculated columns. How can I use them as filters so if I click on Y1, it will show the numbers only for Y1. Currently Y1 is a calculated column.

daxa.JPG

1 ACCEPTED SOLUTION

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

hI @Kolumam

 

I can think of this technique.

Assuming your Table Name is Table1

 

First create a Calculated Table from the Modelling Tab>>New Table

 

Parameters =
DATATABLE (
    "Index", INTEGER,
    "MyColumns", STRING,
    {
        { 1, "Y1" },
        { 2, "Y2" },
        { 3, "Y3" },
        { 4, "Y4" },
        { 5, "Y5" },
        { 6, "Y6" },
        { 7, "Cumulative" }
    }
)

Now create a MEASURE

 

Measure =
VAR selectedcolumn =
    SELECTEDVALUE ( Parameters[Index] )
RETURN
    SWITCH (
        TRUE (),
        selectedcolumn = 1, SUM ( Table1[Y1] ),
        selectedcolumn = 2, SUM ( Table1[Y2] ),
        selectedcolumn = 3, SUM ( Table1[Y3] ),
        selectedcolumn = 4, SUM ( Table1[Y4] ),
        selectedcolumn = 5, SUM ( Table1[Y5] ),
        selectedcolumn = 6, SUM ( Table1[Y6] ),
        SUM ( Table1[Cumulative] )
    )

@Kolumam

 

 

To fix the sorting problem...

 

Select the Parameter Table

Select MyColums

Go to Modelling Tab>>Sort by Columns>>select Index

 

This is shown in picture below

 

filterforcc2.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.