Forum Discussion
Creating Calculated Columns
- 6 years ago
Hi hitesh1607,
>>I am trying to create a Filter for the user where he can sort a report or visual by clicking options like 'Sales less than 40% or Qty change more than 10%'.
Based on your description, I suggest to create a calculated table, and then create a measure for each filter. Since I don't have your sample, I did the following based on my sample.
1.Create a calculated table contains COLUMN A ,B,C as your description in your first post.
Table =
ADDCOLUMNS (
SUMMARIZE ( 'Sales OrderDetails', 'Sales OrderDetails'[productid] ),
"QTY", CALCULATE ( SUM ( 'Sales OrderDetails'[qty] ) ),
"Salesamonut", 'Sales OrderDetails'[Saleamount]
)
2.Create measures for all your filter(To save time I only created three measures):
A<30 = IF( MAX('Table'[QTY]) <1000,1,0)
3.Create a table for slicer on these measures (How to use measures for slicer, please refer tohttps://www.fourmoo.com/2017/11/21/power-bi-using-a-slicer-to-show-different-measures/😞
4.Create a measure for filter on the visual:
Measure =
VAR SELECTEDVALUE =
SELECTEDVALUE ( Table2[Slicer] )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE = "A<30", [A<30],
SELECTEDVALUE = "D", [D],
SELECTEDVALUE = "C<50", [C<50]
)
5.Add the measure to the visual level filter:
For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EU_kkYgRWzVJr3b7nm634WsB0xtNchanjgHNDOtmubxJ-g?e=drSLyC
Best Regards,
Dedmon Dai
FrankAT - Hi Frank please check my post reply to Matt. I have explained that Column A and Column B are measures. Sorry for the misunderstanding.