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.
% Of Sales By SubCategory =
DIVIDE([_TotalSales],CALCULATE([_TotalSales],ALL(DimProductSubcategory[ProductSubcategoryName]) ),0)*100
here i would like to Filter only records whose % is more than 10%
can some one rewrite the expression for me
Solved! Go to Solution.
Hi @Anonymous,
You can modify your formula to return tag, then drag it to visual level filter to filter unmatched records:
% Of Sales By SubCategory = VAR SalesBySubCat = CALCULATE ( [_TotalSales], ALL ( DimProductSubcategory[ProductSubcategoryName] ) ) VAR PercentOfSale = DIVIDE ( [_TotalSales], SalesBySubCat, 0 ) * 100 RETURN IF ( PercentOfSale > 10, 1, 0 )
Regards,
Xiaoxin Sheng
% Of Sales By SubCategory = VAR SalesBySubCat=CALCULATE([_TotalSales],ALL(DimProductSubcategory[ProductSubcategoryName])) VAR PercentOfSale =DIVIDE([_TotalSales],SalesBySubCat,0)*100 Return PercentOfSale>10
//here from below screen shot i want only true records to be displayed.
Any solution for this please.
if you want to use the DAX filter you will also need to put it in the [SalesAmount] as well - otherwise it will give you blank for the % measure, and amounts for the [SalesAmount]
@Anonymous solution prevents that
Otherwise I would try with something like:
VAR SalesBySubCat=CALCULATE([_TotalSales],ALL(DimProductSubcategory[ProductSubcategoryName])) VAR PercentOfSale =DIVIDE([_TotalSales],SalesBySubCat,0)*100 VAR SubCategoryFilter = FILTER(ADDCOLUMNS(SUMMARIZE('DimProductSubcategory',DimProductSubcategory[ProductSubcategoryName]),"Val",PercentOfSale),[Val]>10) RETURN CALCULATE(DIVIDE([_TotalSales],SalesBySubCat,0)*100,SubCategoryFilter)
idea is to 'summarize' current subcategory by PercentOfSale and filter out those that do not meet the criteria and then use that as a CALCULATE parameter
Also you cannot use the PercentOfSale cause it will always return value from before you have filtered
Have you tried placeing the [% Of Sales By SubCategory] into your report filters and setting it to only show "True"?
Thanks Ross for reply,actually i dont want to fiter it by slicer or Default filters,but to filter using DAX expression on caluculated result set.
% Of Sales By SubCategory = VAR SalesBySubCat=CALCULATE([_TotalSales],ALL(DimProductSubcategory[ProductSubcategoryName])) VAR PercentOfSale =DIVIDE([_TotalSales],SalesBySubCat,0)*100 Return PercentOfSale>10
here instead of retruning True or False i want only True records to be fetched,False should be excluded in result.
Hi @Anonymous,
You can modify your formula to return tag, then drag it to visual level filter to filter unmatched records:
% Of Sales By SubCategory = VAR SalesBySubCat = CALCULATE ( [_TotalSales], ALL ( DimProductSubcategory[ProductSubcategoryName] ) ) VAR PercentOfSale = DIVIDE ( [_TotalSales], SalesBySubCat, 0 ) * 100 RETURN IF ( PercentOfSale > 10, 1, 0 )
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |