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
kakashi-jk3
Frequent Visitor

Need help with simple filtering on my dataset in power bi

 

Hello PowerBi community!

I'm really new to using powerbi and I'm trying to do a couple filtering on my tables so I can visualize my data.

Some of the filtering is described under here.

I've been using countless of hours trying to figure out how to solve these filtering, but it seem like powerBi desktop is only able to do simple filtering (the one on the right side). So I wonder if some experts here maybe know how I can solve these filtering?

I managed to write a DAX function to retrieve only the last (newest) report, to a new table.

But I can't seem to get this to work.

 

 

Example: Tablename: report

The columns in the table report is defined in []

X is an int number.

 

We want to retrieve all the project with report where:

 

It should be possible to take overview reports of all projects that:

  • [MarginLastMonth] less than X% (if it's possible to get this int as user input in front end. it would be nice, or else we would have to specify it before we embedd)
  • [MarginLastMonth] is less than [AdjustedMargin]
  • [eacHours] is X% times larger than [adjustedMargin]
  • [MarginLastMonth] has reduced X month in a row.
  • [eacHours] has increased more than [adjustedTimeBudget]  "X" month in a row
  • No report exist for the [expectedEndDate]. (Also there is no report uploaded, which should have been uploaded for the last month)

 

An aggregated report aggregates data from last reporting for each project included in the report. The report must contain the following fields:

  • Weighted average of [adjustedMargin], where weight is based on [eacHours] (Here I found something about using SUMX, but I didn't manage to retrieve a correct answer)
  • Weighted average of [MarginLastMonth], where weight is based on [eacHours] (Here I found something about using SUMX, but I didn't manage to retrieve a correct answer)

 

Best regards.

Hope someone would be able to help me out in this one. 

 

15 REPLIES 15
Greg_Deckler
Super User
Super User

In general, create a measure in the following format:

 

Measure = CALCULATE(SUM(Table[Column],FILTER(Table,[Column]>[Column]))

For example, specifics will depend on the data and particular measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

Could you give me an example for the criteria over? Not sure if I understood it, since i couldnt manage to get it to work.

Anonymous
Not applicable

@kakashi-jk3

 

Sorry for not answering. Will get back to you tomorrow.

@Anonymous

 

Did you have time? 🙂

Anonymous
Not applicable

@kakashi-jk3

 

I have a meeting in 1 hour, which I need to prepare for. After that meeting I will look into your problem. In the mean time, could you provide me with sample data? I'll make DAX measures for each of your desired KPIs.

@Anonymous the pbix models?

Anonymous
Not applicable

Yea or an excel with identical data. If data is sensitive, you can perhaps mask it, or somehow hide the sensitive information. 

The only problem is that its connected to our azure database by basic, is it any possible to remove that. while keeping the tables?

 

By default we use azure SQL, does it work to just download the excel for database? Will the queries you write work for the azure sql format like the excel?

Anonymous
Not applicable

what you can do is to:  go to the Data button in the menu on the left -> Left-click and choose copy table -> Paste into excel (do for both tables) -> attach excel to your reply. Then, later on, I'll write some dax measure, which you can just copy paste into your pbix. Smiley Happy

 

Does this make sense? I'll gladly elaborate, if you are in doubt of anything.

I sent you a message @Anonymous! 🙂 

 

Thanks

Anonymous
Not applicable

Hi @kakashi-jk3

 

Can you tell a little more about how your data is stored? Possibly provide me with a table example of how your data is stored.

 

From what you've descrived, it should be overcomeable to create the measures, you've listed. I just need some more information first.

 

Best,

Martin 

@Anonymous Thank you for your answer. 

 

Here is the table and the columns. Project and report has projectCode as relationship.

 

bcvbcv.PNG

 

At the moment these powerBi is doing direct query (and not the import one, since I can't find a way to get the live update on dataset to work with import.).

 

Here is how the data is stored for each column in the table report.

 

bvcbcvbcv.PNG

 

Please tell me if you need to know anything else!

 

Best regards

Anonymous
Not applicable

@kakashi-jk3

 

The solution to some of your problems is the following:

 

This should be a calculated column in report table:

 eacHours is X% times larger than adjusted margin = 'Report'[eacHours] / 'Report'[adjustedMargin]

 

This should be a calculated column in project table:

 Has a done report = IF(CONTAINS(RELATEDTABLE(report);report[status];"utkast");0;1)

 

This should be a calculated column in your report table:

Month = FORMAT(report[createdDate]; "YYYY-MM")

 

This should be a calculated column in report table:

MarginLastMonth is less than AdjustedMargin = IF(report[marginThroughLastMonth]<report[adjustedMargin];1;0)

 

To solve the last 2 measures I need data for another month. 

Anonymous
Not applicable

@kakashi-jk3 Thanks for the reply.

 

 

 

And what does one row represent in report-table and project-table? Does it represent one project?

 

 

@Anonymous sorry for answering so late, the relationship is that one projects can have many reports. While one report can have one project.

Which means one row in report means one report for a specific projectCode.

one row in project means one project.

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.