Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
ppriya
Frequent Visitor

Filter to be automated on the basis of selection in the field

Hi all,

 

Need to automate the Filter section in DAX on the basis of selection in a particular field.

You need to make the selection in Testaname field.

Below is the data Set

 

IDEmployee IDEmployee NameEmployee Status
1E1ABCActive
2E2CEFActive
3E3GHIActive
4E4JKLInactive
5 MNOActive
6E6PQRActive
7E7 Active
8E8VWActive
9E9XY 
10E10ZActive

 

RowID TestaNameTable NameField
1Employee ID is BlankTest DataEmployee ID
2Employee Name is BlankTest DataEmployee Name
3Employee Status is BlankTest DataEmployee Status

 

When i do any selection in TestaName field it should return me the count of blank of that particulate column in the 1st table 

 

Dax which i created and is not working

Project_Measure_testing =
VAR vTablename = SELECTEDVALUE(FA_DATA_MATURITY[TABLE_NAME])

VAR vFieldname = "Filter('"&SELECTEDVALUE(FA_DATA_MATURITY[TABLE_NAME])&"',isblank('"&SELECTEDVALUE(FA_DATA_MATURITY[TABLE_NAME])&"'["&SELECTEDVALUE(FA_DATA_MATURITY[FIELD_NAME])&"]))"

Return --Query
Calculate(count(LU_PROJECT[PROJECT_ID]),vFieldname)
 
Kindly help me with this.
 
Thanks !
5 REPLIES 5
v-yadongf-msft
Community Support
Community Support

Hi @ppriya ,

 

Field parameters are recomended.

 

Please create three measures:

Employee ID is Blank = CALCULATE(COUNT('Table'[Employee ID]),FILTER('Table','Table'[Employee ID] = BLANK()))

Employee Name is Blank = CALCULATE(COUNT('Table'[Employee Name]),FILTER('Table','Table'[Employee Name] = BLANK()))

Employee Status is Blank = CALCULATE(COUNT('Table'[Employee Status]),FILTER('Table','Table'[Employee Status] = BLANK()))

 

Modeling - New parameter - Fields

vyadongfmsft_0-1665456226130.png

 Add fields:

vyadongfmsft_1-1665456260813.png

Create a slicer:

vyadongfmsft_2-1665456338991.png

 

Create a card visual:

vyadongfmsft_3-1665456390271.png

 

You will get the count of blank of that particulate column in the 1st table :

vyadongfmsft_4-1665456449349.png

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 
Actually i am looking out for a solution where in i need not create multiple DAX.just on the basis of selection the tablename and fieldname changes and i get the output.
Any Suggestion
 
 
 
 
 
 
 
 
 
 
 

Hi @ppriya 

 

Did I solve your problem? If solved, please consider Accept it as the solution to help the other members find it more quickly.

 

Best regards,

Yadong Fang

ppriya
Frequent Visitor

Kindly help with the issue .

ppriya
Frequent Visitor

Correct Dax
 
Project_Measure_testing =
VAR vTablename = SELECTEDVALUE('Mapping table'[Table Name])

 

VAR vFieldname = "Filter('"&SELECTEDVALUE('Mapping table'[Table Name])&"',isblank('"&SELECTEDVALUE('Mapping table'[Table Name])&"'["&SELECTEDVALUE('Mapping table'[Field])&"]))"



Return vFieldname
--Calculate(count('Test Data'[ID]),vFieldname)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors