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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Singularity9
Helper I
Helper I

Created a table as a variable in a measure. Filtering by one column doesn't change the results.

I've created a measure. It's using a table, table1. In this table I have created a table test12 as a variable, like so:

var test1 = SUMMARIZE(
CALCULATETABLE(
Table1,
Table1[Value1]="A"
&&Table1[Area]<>"Area1"
&&Table1[Area]<>"Area2"
"), Table1[Area]
)
var test12 =
ADDCOLUMNS(
test1,
"lastmonth",
calculate([Last Month Total],Table1[Value2]="B"),
"prevmonth",
calculate([Previous Month Total],Table1[Value2]="B"),
"Difference",
calculate([Last Month Total],Table1[Value2]="B")-calculate([Previous Month Total],Table1[Value2]="B"),
"Percentage",
divide(
calculate([Last Month Total],Table1[Value2]="B")
-
calculate([Previous Month Total],Table1[Value2]="B"),
calculate([Previous Month Total],Table1[Value2]="B")))

Apologies, I know my code could use a cleanup. I'm trying to return values from the table test12, filtered by other values in test12. But filters don't seem to work at all. For example, when I ask it to return, 

countrows(test12)& " "&
calculate(countrows(test12),filter(test12, [Percentage]>1000&&[prevmonth]+[lastmonth]>0))

It returns two values separated by a space, one which is the correct number of rows I'm expecting in table 12 (i.e., the total number of distinct areas) and one which is exactly the same as the first. The filters don't have any effect. The percentage is not over 1000 for any of the values in test12, I just used that as an example to confirm that the filter wasn't doing anything. Can anyone help? Thank you in advance.
2 REPLIES 2
Anonymous
Not applicable

Hi,@Singularity9 
Has the problem been solved? If it does, share your solution and accept it as a solution that will help other community members who have the same problem as you.

If not, I would appreciate it if you could provide me with a PBIX file or sample data. When uploading a pbix file, delete sensitive data and don't sign in to your account in Power BI Desktop. It is recommended to use SharePoint or Onedrice

 

If you have any other questions please feel free to contact me.

 

Best Regards,

Leroy Lu

foodd
Super User
Super User

Hello @Singularity9 , and thank you for sharing a question with the Community.   This reply is informational.   Please remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot). You can upload the PBIX file to a cloud storage service such as OneDrive, Google Drive, Dropbox, or to a Github repository, and then share a file’s URL.

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

 

If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.  Proud to be a Super User!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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