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
gluizqueiroz
Resolver I
Resolver I

How to create a table in a variable in a measure and ignore some filters?

I have create a measure that uses some variables, to calculate a specific percentage. The measure is like the following example:

 

 

 

Measure = 
VAR DifYears = SELECTEDVALUE(Table1[DifYears])
VAR __table1 = ALLSELECTED(Table2[YearSold]; Table2[YearHire]; Table2[DifYears])
VAR __table2 = ADDCOLUMNS(__table1; "Percentage"; [Calc Percentage])
VAR __table3 = FILTER(__table2; [Percentage] > 0)
VAR __table4 = GROUPBY(__table3; [DifYears]; "Final Percentage"; AVERAGEX(CURRENTGROUP(); [Percentage]))
VAR __table5 = SELECTCOLUMNS(FILTER(__table4; [DifYears] = DifYears); "Total"; [Final Percentage])
RETURN
__table5

 

 

 

It is a simple example, my problem is on the variable __table1
I create a variable that is a table (bc. ALLSELECTED), and I have a slicer filter in a page and this measure should ignore the slicer filter YearHire, and this is my problem.

 

How I can create this variable (__table1) with this 3 columns but ignoring the slicer filter?

4 REPLIES 4
Icey
Community Support
Community Support

Hi @gluizqueiroz ,

Is this problem solved?

 

Best Regards,

Icey

Mariusz
Community Champion
Community Champion

Hi @gluizqueiroz 

 

Try adding this to your expression.

VAR __table0 = CALCULATETABLE( Table2, ALLSELECTED( Table2[YearSold]; Table2[DifYears] ), ALL( Table2[YearHire] ) )
VAR __table1 = GROUPBY( __table0; Table2[YearSold]; Table2[YearHire]; Table2[DifYears] )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Icey
Community Support
Community Support

Hi @gluizqueiroz ,

How about creating a new table, which is only one column "YearHire"? This table is independent of other tables. Then, use this column as a slicer to filter. 

If it not works, please show me your data structure and give me some example data, not real data.

 

Best Regards,

Icey

amitchandak
Super User
Super User

If possible please share a sample pbix file after removing sensitive information.
Thanks

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.