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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
NadeemAhamed
Helper V
Helper V

how to pass the filtered name from slicer into column name in measures and apply the filteration for

Dear All,

Good Day.

 

I have attached the excel and pbix file for your reference. 

 

I want to apply the slicer value as a column name in measures. 

 

Ex: test=

var _mnth=FORMAT(SELECTEDVALUE('Month'[Month]),"MMM")
RETURN
CALCULATE(SUM(testing[Apr]),FILTER(testing,testing[Company Name]="A" && testing[Month]=_mnth && testing[Plan/Actual]="Actual")
)

 

 

* I want to apply the slicer value in the place of static column name as mentioned above measures. 

 

Excel: https://toyotsu.box.com/s/iz91ukipab73cncpfaqjawok3z04vsl1

Pbix: https://toyotsu.box.com/s/ewpl7qlo1n7xdi6mecghhfsfuuh883f4

 

Request: Kindly suggest any another table structure which will reduce the table rows. (Bcz this table will going to have data from April-March)

 

Thank you in Advance. 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NadeemAhamed 

 

I downloaded and viewed your files. I realize that your problem may be that the slicer selection is not working for the measure.


This may have something to do with your table structure.

 

I noticed that you created the slicer using "Month", but in the matrix you put the values for each month.

 

In fact, the months in the slicer are not related to the months you have in the table. Therefore, the slicer cannot filter the table.

 

You can try the following:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1710741692270.png

 

Select the month column and click "Unpivot Columns".

vnuocmsft_1-1710741765404.png

 

The table is transformed into the following form, and you can rename it to "Month".

vnuocmsft_3-1710742112451.png

 

Click on "Close & Apply".

vnuocmsft_4-1710742177723.png

 

In the meantime, I have made some changes to your code.

 

Create a measure.

test = 

var _mnth=
    FORMAT(
        SELECTEDVALUE(
            'Table'[Month]),
            "MMM"
        )

RETURN

CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        ALL('Table'),
        'Table'[Company]="A" 
        && 
        'Table'[Month]=_mnth 
        && 
        'Table'[Plan/Actual]="Actual"
        )
    )
 

 

Here is the result.

vnuocmsft_5-1710742298751.png

 

Regards,

Nono Chen

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

1 REPLY 1
Anonymous
Not applicable

Hi @NadeemAhamed 

 

I downloaded and viewed your files. I realize that your problem may be that the slicer selection is not working for the measure.


This may have something to do with your table structure.

 

I noticed that you created the slicer using "Month", but in the matrix you put the values for each month.

 

In fact, the months in the slicer are not related to the months you have in the table. Therefore, the slicer cannot filter the table.

 

You can try the following:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1710741692270.png

 

Select the month column and click "Unpivot Columns".

vnuocmsft_1-1710741765404.png

 

The table is transformed into the following form, and you can rename it to "Month".

vnuocmsft_3-1710742112451.png

 

Click on "Close & Apply".

vnuocmsft_4-1710742177723.png

 

In the meantime, I have made some changes to your code.

 

Create a measure.

test = 

var _mnth=
    FORMAT(
        SELECTEDVALUE(
            'Table'[Month]),
            "MMM"
        )

RETURN

CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        ALL('Table'),
        'Table'[Company]="A" 
        && 
        'Table'[Month]=_mnth 
        && 
        'Table'[Plan/Actual]="Actual"
        )
    )
 

 

Here is the result.

vnuocmsft_5-1710742298751.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors