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.
My Table1 like below:
Type Market Country Month Comment Level
Business Europe Italy Apr20 Project Completed Global
Business Europe Italy Apr20 Continue focus on automation Market
Business Europe Denmark Apr20 Testing ongoing Market
If Market slicer select Europe, I want it to display row 2 & row 3.
if Market slicer select All, I want it to display row 1
I try apply below using a few exp like FirstNonBlank but still not work.
View= If( HASONEFILTER(Table1[Market];
Calculate(<exp>(Table1[Comment]); Filter(Table1; Table1[Level]="Market");
Calculate(<exp>>(Table1[Comment]); Filter(Table1; Table1[Level]="Global")
)
what <exp> should i use? I tried FirstNonBlank but only one row is displayed. Is there any formula should I use?
Thank in advance
Solved! Go to Solution.
Hi,
This should be what you are looking for:
SelectedValue =
var v_filterenabled = ( ISFILTERED(Market_Country[Country]) || ISFILTERED(Market_Country[Market]))
var v_filtervalue = IF(v_filterenabled;"Market";"Global")
return
CALCULATE(COUNTROWS('Table');FILTER('Table';'Table'[Level]=v_filtervalue))
When no filter is applied is shows the global record:
When a filter is applied is shows the "Market" record:
Please note that it requires this datamodel.
Power BI file is here.
Please mark as solution if this is what you are looking for. Thanks!
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi,
This should be what you are looking for:
SelectedValue =
var v_filterenabled = ( ISFILTERED(Market_Country[Country]) || ISFILTERED(Market_Country[Market]))
var v_filtervalue = IF(v_filterenabled;"Market";"Global")
return
CALCULATE(COUNTROWS('Table');FILTER('Table';'Table'[Level]=v_filtervalue))
When no filter is applied is shows the global record:
When a filter is applied is shows the "Market" record:
Please note that it requires this datamodel.
Power BI file is here.
Please mark as solution if this is what you are looking for. Thanks!
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi Steve,
Thank you very much for your solution. Really appreciate it.
Hi,
Can you please clarify what end result you are trying to obtain? If you added the [Market] column to a slicer and selected Europe, it would return all 3 columns. Are you trying to slice by [Level] instead?
Thanks,
Kim
Hi Kim,
Thanks for the respose.
My slicer is only [Market] and [Country]. If both slicer NOT select anything (All), then only row that has 'Global' value in column Level is displayed. I don't want create [Level] as slicer.
Thanks in advance.
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 |
---|---|
47 | |
23 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
42 | |
39 | |
19 | |
19 |