The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello Power BI Community,
I need some help with the following Dax code:
allvalue_SingleSelect =
VAR BrandsSelection = ISFILTERED('df_brands'[Brands])
VAR TotalCount =
IF (
BrandsSelection,
CALCULATE( DISTINCTCOUNT(Respondent[Unique_ID])
, 'df_brands'[value] = "Yes", 'df_Occasions'[value1] = "Yes",
'df_Category Purchased'[value] = "Yes"
, ALLSELECTED('df_Search Order (First)'[Search Order (First)])
), CALCULATE(
DISTINCTCOUNT(Respondent[Unique_ID]), 'df_Brands'[value] IN {"Yes", "No", "", "Null"}, 'df_Occasions'[value1] = "Yes",
'df_Category Purchased'[value] = "Yes"
, ALLSELECTED('df_Search Order (First)'[Search Order (First)])
))
RETURN TotalCount
this dax measure returns the following table for example :
Search Order (First) allvalue_SingleSelect
Pack Type First 9089
Pack Type First 9089
Brand First 9089
Unit Type First 9089
Nutritional Content First 9089
Flavour Variant First 9089
Pack Size First 9089
Returnable Packaging First 9089
Category First 9089
Price First 9089
Temperature First 9089
Format First 9089
Promotion First 9089
Product Origin First 9089
Try New First 9089
Packaging Design First 9089
Others First 9089
but when i filter the power bi table to Search Order (First) = Pack Type First for example
Search Order (First) allvalue_SingleSelect
Pack Type First 533
the value of allvalue_SingleSelect changes to 533 but it should remain as the total - 9089
how can i update the measure to get 9089 even if Search Order (First) column is filtered?
here is the sample pbix: https://drive.google.com/file/d/11FppQjqX3oQEEcPuwStBxAYBdY66i-R-/view?usp=sharing
@MFelix , @amitchandak , @Ashish_Mathur
Hi, @PriyankaJhaTheA
You can try using the Summarize and filter functions to make Measure automatically aggregate into a static sum, independent of the slicer. Also, since your [TotalDistinctCount_Category_Occasions_SingleSelect] is also a dynamic metric and will change depending on the choice of slicer, it is recommended to create a copy of [TotalDistinctCount_Category_Occasions_SingleSelect] that is not affected by the slicer. Then go and create the [allvalue_SingleSelect] measure.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |