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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mgg
Helper I
Helper I

Calculate with filter

Spoiler

Hello,

I'm in a trouble with a filter.

I need to show a score filtering the data using a measure (not fixed data)

I'm using the following but it doesn't work:

 

CALCULATE([SpeScore], FILTER(SPE, SPE[Period]=[SpeLastPeriod]))

 

Anyone can help me?

Thans in advance

2 ACCEPTED SOLUTIONS
Migasuke
Super User
Super User

Hi,
If I got you right, you trying to calculate SpeScore for latest value.
Unfortunatelly this does not work but there is an easy.

1. In your SPE table, create a calculated column with MAXX and IF, where you specify the latest (period, date, year...)

Migasuke_0-1625785326770.png

2. Use your DAX measure, only adjust the condition bit, something like this:

Migasuke_1-1625785504735.png

As you can see, I get the value for Period 5, which is the latest.

Please let me know, how did it help!



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

View solution in original post

Hi,
It should work fine, if you use column, which has "Latest" by Company, check this:

Migasuke_0-1625850670447.png

The measure then will be a bit adjusted:

Latest Value =
CALCULATE(SUM(SPE[Value]),SPE[Latest In Group]="Latest")

Once you use slicer, it will behave the way you want.


If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

View solution in original post

7 REPLIES 7
Mgg
Helper I
Helper I

GREAT ...problem solved !!!

Many thanks

Migasuke
Super User
Super User

Hi,
If I got you right, you trying to calculate SpeScore for latest value.
Unfortunatelly this does not work but there is an easy.

1. In your SPE table, create a calculated column with MAXX and IF, where you specify the latest (period, date, year...)

Migasuke_0-1625785326770.png

2. Use your DAX measure, only adjust the condition bit, something like this:

Migasuke_1-1625785504735.png

As you can see, I get the value for Period 5, which is the latest.

Please let me know, how did it help!



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Thanks for your solution but I have an additional complexity: How I can define the "Latest" period taking in consideration also the "Company"?

Mgg_0-1625823059026.png

In the example the latest period for the companies B and D is 2 and NOT 3 like for companies A and C

Hi @Mgg ,
That depends how you trying to visualize the measure or what should be the output.
For example, you can use your measure with Company Slicer and everything will work well.



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

I'm doind that but its showing always the latest period and so, if the company there isn't in that period (eg Company B period 3) it shoed score "blank.

I'd like to label the latest period x company and not the latest per colum like it is.

Hi,
It should work fine, if you use column, which has "Latest" by Company, check this:

Migasuke_0-1625850670447.png

The measure then will be a bit adjusted:

Latest Value =
CALCULATE(SUM(SPE[Value]),SPE[Latest In Group]="Latest")

Once you use slicer, it will behave the way you want.


If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

GREAT...problem solved

Thanks for your support.

Now the filter is working well 💪

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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