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
Anonymous
Not applicable

Use changing or dynamic values of Measure as Slicer

Hello,

I understand we can use disconnected table approach (probably the only way?) to use Measure values (texts in my case) in Slicer. It works nicely when the values in Measure are required to be shown in a Slicer all the time, i.e. the selection list is "static".
In my case I want the Slicer values to show the changing calculated value of Measure which can be different based on other slicers' selections during runtime i.e. selection list is "dynamic". Any suggestions on how this can be achieved?

 

Thanks

Nirmit

6 REPLIES 6
Anonymous
Not applicable

Hi @amitchandak, Thanks for your answer. Apparently I got stuck in the first step of filtering the data on Measure value using disconnected table itself. Not able to set it up for my scenario. I did watch your youtube video for creating mesaure slicer and for dynmaic segmentation as well (thanks for great videos though) but my problem is - in my scenario the Mesaure in question is not calculated from numeric values (like sales amount) but it is a text categorization purely based on other column text values and another slicer. Thus I am not able to just set it up. Could you help me get through this please?


Below is a very simplified version of my scneraio. There are many more fields in both the Dim and Fact tables. Dim table has thoudands and Fact has lakhs of records.
Dim_Asset

AssetOwner
ACompany1
ACompany2
BCompany1
CCompany2
CCompany3


Fact_Incident

AssetIncidentTypeMeasure_AssetType
AHardware 
BHardware 
COS 

 

Measure_AssetType is required to be calculated dynamically based upon selected Owner, say first slicer, and reported IncidentType from fact table.
Lastly I want to show the values of Measure_AssetType within second slicer and allow users to filter all visuals of the multiple Pages for that value. Now since every visual is at different granularity and measure output is a text, facing challenge in defining such a measure which can be used with disconnected table approach.

Below is the logic required for Measure_AssetType:
IF (Dim_Asset[Owner] = "Company1" && Fact_Problem[ProblemType] = "Hardware") THEN "Workstation"
ELSEIF (Dim_Asset[Owner] = "Company1" && Fact_Problem[ProblemType] = "OS") THEN "Server"
(Dim_Asset[Owner] = "Company2" && Fact_Problem[ProblemType] = "Hardware") THEN "Deprecated"
ELSEIF (Dim_Asset[Owner] = "Company2" && Fact_Problem[ProblemType] = "OS") THEN "Fixed"
ELSE ""

As a result, I want a slicer which shows below values and filters all visuals data as applicable.

When Company1 is selected in Owner slicer:
Slicer_Measure_AssetType

Workstation
Server

 

When Company2 is selected in Owner slicer:
Slicer_Measure_AssetType

Deprecated
Fixed

 

When Company3 is selected in Owner slicer:
Slicer_Measure_AssetType

 

How can this be achieved? Thanks in advance for help.

Regards

Nirmit

Anonymous
Not applicable

Hi @Anonymous 

Here I create two same table [Dim_Asset] and [Fact_Incident] to have a test. We couldn't add a measure into Slicer.

Try to create a calculated table by dax to for slicer.

Slicer_Measure_AssetType = 
{"Workstation","Server","Deprecated","Fixed",""}

Add a calcualted column in this table.

Owner = 
SWITCH (
    TRUE (),
    Slicer_Measure_AssetType[Value] IN { "Workstation", "Server" }, "Company1",
    Slicer_Measure_AssetType[Value] IN { "Deprecated", "Fixed" }, "Company2"
)

Then create a relationship between Dim_Asset[Owner] and Slicer_Measure_AssetType[Owner].

1.png

Then create a measure to calculate Measure_AssetType by your logic.

Measure_AssetType = 
VAR _AssetType =
    SWITCH (
        MAX ( Dim_Asset[Owner] ),
        "Company1",
            SWITCH (
                MAX ( Fact_Incident[IncidentType] ),
                "Hardware", "Workstation",
                "OS", "Server"
            ),
        "Company2",
            SWITCH (
                MAX ( Fact_Incident[IncidentType] ),
                "Hardware", "Deprecated",
                "OS", "Fixed"
            )
    )
VAR _SelectValue =
    VALUES ( Slicer_Measure_AssetType[Value] )
RETURN
    IF ( _AssetType IN _SelectValue, _AssetType, BLANK () )

Result is as below.

Select Company2:

1.png

Then select "Deprecated"

2.png

 

Best Regards,
Rico Zhou

 

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

Anonymous
Not applicable

Hi @Anonymous 

Thank you for detailed repsonse. Your solution seems to be working at table level visual when all fields are added to the view. However as soon as any field is taken out, the Measure, being a measure using MAX, is recalculated and returns a different value. That is a problem.

For example, in below picture, I have added another table visual and taken Incident Type out from this view, the Measure_AssetType recalculates to "Server". While I wanted to retain the same value "Workstation" at all levels.
In summary, in my case, I want the 'field' AssetType to return a different value at most granular level depending upon selection in Owner Slicer and as per formula given in my above post, and then it should retain that computed value at all aggreation levels as long as the Owner Slicer selection is not changed. Hope it is clear. How can that be achieved?

nirmit27_0-1639508686528.png

Thanks

Nirmit

Anonymous
Not applicable

Hi @Anonymous ,

I think you can solve this issue by change the relationship direction between "Fact_Incident" and "Dim_Asset" from single to both.

1.png

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

Anonymous
Not applicable

Hi @Anonymous 

Thanks again for response. This unfortunately still isn't working for me. Main reason being I have multiple records of same asset in fact table and in reality my data model is actually not a simple star schema. It is kind of snow flake built due to RLS requirement.
Sorry if my explanation was not clear or if was not complete, clarifying it more below:

1. Data model I shared is a very scaled down version of my big data model. My dim and fact tables are not directly connected rather there are multiple dim tables in between. It goes like this: (Owner is Vendor. I have changed the table names slightly to make it understandable)
dim_User_Vendor > dim_Vendor > dim_Vendor_Profile > dim_Profiles > dim_Asset_Profiles > dim_Asset > Fact_incident

dim_Asset does not contain the Vendor (Owner) field but it is located in dim_Vendor

I have Row Level Security implemented on very first table dim_User_Vendor and it flows all the way to the Fact table based on USERPRINCIPALNAME(). Sharing below concerned part of my model.

nirmit27_1-1639554645725.png

2. In my sample data, I indicated only one record per Asset in Fact_Incident table perhaps due to which in your PBIX file it is at the one-side of the relationship. In reality, fact table contains multiple records per asset and is at many-side of relationship. To test, I added two more records in your PBIX file in fact table one for each asset A and B. The measure again re-calculates to a different value at a different aggregation level. Please see below.

nirmit27_4-1639555798465.png

nirmit27_3-1639555254344.png

nirmit27_2-1639555196828.png


I have strong feeling that I want my AssetType to behave just like a "Column" (i.e. no aggregation) after it is calculated based on Vendor/Owner selection. Do you think it is a contradictory requirement to the way Measures work and cannot be achieved using a Measure? If yes then only option which I can think of is to split and prepare the Fact table data seperately one for each vendor and create a calculated column AssetType in each of split fact tables (and maybe Union all together afterwards). With that approach I will end up with duplicate data rows across vendors which again makes it complicated to handle.

Looking forward to your thoughts.

Regards

Nirmit

amitchandak
Super User
Super User

@Anonymous , Then in that case the measure table you create needs to have a reference for that say column 2

 

Then you can use visual level filter in slicer

countrows(filter(MeasureTable, MeasureTable[Column 2] in allselected(Table2[Column 2] ) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

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