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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
13havya
Frequent Visitor

Overriding Filters and slicers for a particular measure

Hi All,

 

I've been struggling to create a measure based on certain conditions as described by stakeholders.

 

I have two tables being used in this instance - 

Table1(Fact Table)

casekeyFile typeFile subtypeOther fields....
1Sales ***
2Operations ***
3GeneralSales***
4Sales ***
5GeneralOperations***
6GeneralSales***
7General ***
8Operations ***
9General ***



Dim_File_Type(DIm Table)

File_Type
Sales
General
Operations

 

 

I want to create a measure that returns a count of all files - with the caveat that files where the subtype is present count towards both the main file type and its respective subtype. 

For instance, files # 3 and 6 count towards both General and Sales, and # 5 counts towards General and Operations. 
So if I were to create a visual, the results should be like so - 

File_Type# Files
Sales4
General5
Operations3

 

I understand that certain files will be counted twice - which is how we want the metric to behave. 

 

Any insights on this would be greatly appreciated. 

 

Thanks

2 ACCEPTED SOLUTIONS
vicky_
Super User
Super User

Try a measure like the following:

# Files = COUNTROWS(FILTER('Table', 'Table'[File subtype] = SELECTEDVALUE(Dim_File_Type[File_Type]) || 'Table'[File type] = SELECTEDVALUE(Dim_File_Type[File_Type])))

View solution in original post

v-weiyan1-msft
Community Support
Community Support

Hi @13havya ,

 

@vicky_ nice method! Thank you, for your quick response and the solution provided.
And you can also try code as below.

# Files = 
VAR File_Type = SELECTEDVALUE ( Dim_File_Type[File_Type] )
RETURN
    SUMX (
        'Table1',
        IF (
            'Table1'[File subtype] = File_Type
                || 'Table1'[File type] = File_Type,
            1,
            0
        )
    )

Result is as below.

vweiyan1msft_0-1708499948920.png

 

Best Regards,
Yulia Yan


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-weiyan1-msft
Community Support
Community Support

Hi @13havya ,

 

@vicky_ nice method! Thank you, for your quick response and the solution provided.
And you can also try code as below.

# Files = 
VAR File_Type = SELECTEDVALUE ( Dim_File_Type[File_Type] )
RETURN
    SUMX (
        'Table1',
        IF (
            'Table1'[File subtype] = File_Type
                || 'Table1'[File type] = File_Type,
            1,
            0
        )
    )

Result is as below.

vweiyan1msft_0-1708499948920.png

 

Best Regards,
Yulia Yan


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

vicky_
Super User
Super User

Try a measure like the following:

# Files = COUNTROWS(FILTER('Table', 'Table'[File subtype] = SELECTEDVALUE(Dim_File_Type[File_Type]) || 'Table'[File type] = SELECTEDVALUE(Dim_File_Type[File_Type])))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.