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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
Memorable Member
Memorable Member

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

Migasuke
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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

Migasuke
Memorable Member
Memorable Member

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.

Migasuke
Memorable Member
Memorable Member

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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