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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.