Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to get a RemoveFilters function to work.
Basically, I want to get a Count of ID in QtData for a specific EquipmentGroup and TimePeriod that ignores any Slicers that impact the Visual Page. As it's ignoring the Slicers, however, I would like to get a count of all the values created in the past 6 months. Below is what I have:
M_6MonthQtCt_Type1-Type2 =
CALCULATE (
COUNT ( QtData[Id] ),
FILTER (
ALL ( EquipmentSelect ),
EquipmentSelect[TypeGrouping] IN { "Type1", "Type1" }
),
FILTER ( ALL ( 'QtData' ), QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] )
)
with M_6MonthsPrev as:
M_6MonthsPrev = EDATE(TODAY(), -6)
I've inlcuded the Data Model below and highlighted the various relations. In the DAX I have so far, I'm only trying to remove the filters on the EquipmentSelect and Calendar table (since I can't get this simple version to work for me yet) but I will eventually add in REMOVEFILTERS, or whatever the correct process is, to remove QtType, QtStatus, EmployeeTeam, and PartnerName, and the filters to PartnerName.
Look forward to any insights on what I'm doing incorrectly here!
***Edit: As a note, I need to use Calculate, instead of, say, a CountRows (if that would work), as I'll also want to get the SUM of QuotedValue at a later time.
UPDATE: Solution found
M_6MonthQtCt_Type1-Type2 =
CALCULATE ( COUNT ( QtData[Id] )
, ALL(DateRangePicker)
, FILTER ( ALL ( 'QtData' )
, QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] )
, EquipmentSelect[TypeGrouping] IN { "Type1", "Type2" }
)
Greg's solution probably would have worked, but found this before figuring out how to implement my solution.
@eaglesilo Let's say that Type1 and Type2 have ID's of 1 and 2, you could do this:
M_6MonthQtCt_Type1-Type2 =
VAR __Table = FILTER( ALL( 'QtData'), EquipmentTypeId IN { 1, 2 } && [qtDate] >= [M_6MonthsPrev])
VAR __Result = COUNTROWS( __Table )
RETURN
__Result
If later you want to do a SUM, then you could replace COUNTROWS with SUMX.
Ended up with the below as the solution:
M_6MonthQtCt_Type1-Type2 =
CALCULATE ( COUNT ( QtData[Id] )
, ALL(DateRangePicker)
, FILTER ( ALL ( 'QtData' )
, QtData[qtDate] >= 'Calendar'[M_6MonthsPrev] )
, EquipmentSelect[TypeGrouping] IN { "Type1", "Type2" }
)
I think your solution would have worked, but EquipmentType.TypeGrouping contains many TypeIDs and this allows for the IDs in the group to change server side and flow through to PBI. (The EquipmentSelect table is pulled directly from SQL and managed and updated within there)
User | Count |
---|---|
79 | |
74 | |
44 | |
32 | |
28 |
User | Count |
---|---|
100 | |
93 | |
52 | |
50 | |
48 |