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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Slicer to Exclude

I have the original dataset as below

IDDayIDAmountType
1112A
1140B
1310A
1320C
2330D
2440A
2350C
3460B
3470C

 

I have created a summarised table grouped by ID and DayID

IDDayIDSumAmount
1152
1330
2380
2440
34130

 

Now I want to be able to use a slicer filter with 'Type' options from the original table to filter 'SumAmount' in the summarised table. I want to exclude the ticked 'Type' option from the summarised table. For example

If I tick 'Type' A in the slicer, the summarised table should look like:

 

IDDayIDSumAmount
1140
1320
2380
34130

 

Can anyone please help with how I can do this?

1 ACCEPTED SOLUTION

@Anonymous ,

 

Ok, I see.

In that case, I would create a [groupID] column by merging the [ID] and [DayID] fields in the unsummarised table ('table').

Then reference this table to create your summarised table ('summTable') by grouping on [ID], [DayID], [groupID], and SUM[Amount].

Send to model and relate table[groupId] to summTable[groupID]. Change relationship filter direction to BOTH.

Use table[Type] as your slicer field, summTable[Amount] (bins) as your X axis, and COUNTROWS(summTable) as your frequency measure on Y axis.

 

*NOTE* Ensure you understand the behaviour of this model setup. Using an unsummarised dimension to filter summarised data may give you unexpected results i.e. the single [Type]s selected in the slicer will output entire summarised groups, not just values specifically related to that [Type].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

7 REPLIES 7
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

The simplest way to do this:

 

Do not summarise your table and keep all the fields.

Create a measure: SUM(yourTable[Amount]).

Put [ID], [DayID], and your new measure into your visual.

Set up your [Type] slicer with the 'Select All' option on, and turn off 'Multi-select with CTRL' option. Then the end user can select all slicer values and deselect the one(s) they don't want.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Hi Pete,

 

Unfortunately I can't do that as I have to make a histogram out of the summarised table.

Hi @Anonymous ,

 

The unsummarised table structure will still work fine for a histogram, just put only [ID]and [DayID] on the axis and use your measure for Values. Alternatively, you can right-click on fields in the Fields list and select 'New group' to bin your values however you like.

 

Perhaps I'm misunderstanding your use case?

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Hi @BA_Pete,

So there's 2 things I want to do.

 

1. I want to be able to filter with the summarised table with 'Type' using a slicer based of the original table, as showcased above. 

 

2. Based on the sumarised table, I want to make a histogram with 'Amount' bins on the x-axis and frequncy on the y-axis ( which comes by placing the 'Amount' in the values section). I also want to be able to filter using 'Type' from the original table.  

 

@Anonymous ,

 

Ok, I see.

In that case, I would create a [groupID] column by merging the [ID] and [DayID] fields in the unsummarised table ('table').

Then reference this table to create your summarised table ('summTable') by grouping on [ID], [DayID], [groupID], and SUM[Amount].

Send to model and relate table[groupId] to summTable[groupID]. Change relationship filter direction to BOTH.

Use table[Type] as your slicer field, summTable[Amount] (bins) as your X axis, and COUNTROWS(summTable) as your frequency measure on Y axis.

 

*NOTE* Ensure you understand the behaviour of this model setup. Using an unsummarised dimension to filter summarised data may give you unexpected results i.e. the single [Type]s selected in the slicer will output entire summarised groups, not just values specifically related to that [Type].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Hi @BA_Pete,

 

When you say merge ID and DayID is this right?

groupID= CONCATENATE('Table'[ID], 'Table'[DayID])
 
And then form the summarised table using
sumTable= SUMMARIZE(table, table[ID],table[DayID],table[groupID],"Amount", sum(table[amount]))
 
Is this right?

Hi @Anonymous ,

 

I would do both in Power Query myself:

// Call this idTable
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSgWAjIOGoFKuDEDIxABJOcCFjkLABiiqQkBFIyBksZAQVMgYJucCFTGBmOaKoMkVoNIaqMkPYCBMyh6qKBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, DayID = _t, Amount = _t, Type = _t]),
    chgTypes = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"DayID", Int64.Type}, {"Amount", Int64.Type}, {"Type", type text}}),
    addGroupID = Table.AddColumn(chgTypes, "groupID", each Text.Combine({Text.From([ID], "en-GB"), Text.From([DayID], "en-GB")}, "-"), type text)
in
    addGroupID

// idTableSumm
let
    Source = idTable,
    groupRows = Table.Group(Source, {"ID", "DayID", "groupID"}, {{"Amount", each List.Sum([Amount]), type nullable number}})
in
    groupRows

 

But if you don't have access to PQ, then I would do the following DAX for the [groupID] field (just to make sure there's no bleed between the ID's):

groupID = [ID] & "-" & [DayID]

 

Your SUMMARIZE DAX looks correct already.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors