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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
vdburg
Resolver I
Resolver I

MDX: return last value for selected items in Power BI

Hi,

This is a question regarding Cubes and MDX formulas.

 

I have a measure with the active members per each month. So when I select for example 2018 it shouldn´t aggregate but return the last available month with active members, and if I break down by month it should give the active members for each month.

 

So I have this formula which works almost fine if querying in managamente Studio

 

 

with member [Measures].[Last existing SOCIOS] AS 
Max(
EXISTING [DIM FECHA].[Jerarquía].[MES NOMBRE].members,
iif([Measures].[ACTIVOS] = 0,null,
[Measures].[ACTIVOS])
)

select {[Measures].[Last existing SOCIOS]} on columns,
[DIM FECHA].[MES NOMBRE].members on rows
from [cubo_Compromisos]
where [DIM FECHA].[AÑO].&[2018]

Which returns this:

 

 

Socios_Activos.JPG

 

I would prefer to have the november value returned at the 'All' level. But this is not my main problem. when I use this measure in Power BI it behaves differently: when selecting multiple months it ignores the selected values and just returns the last value for the whole year.

In the screenshot below I have added the value returned by the KPI Card because that is the value that I want returned:

 

Indicator_Wrong.JPG

 

If I select items like this it does it right, but I need it to select all months, and not just one because I am using this measure along others:

 

Indicator_Right.JPG

Does anyone know the right MDX function to use or an alternative?

 Thanks

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi vdburg,

 

It seems like your issue is more related with SSAS, I would recommend you to submit your issue to SSAS forum for more support.

 

Regards,

Jimmy Tao  

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors