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
Ynew
Helper I
Helper I

Referring A Measure inside Another Measure

Hi,

 

I have a problem with referring a measure in other measures. It seems that my second measure does not understand the reference, so could you generally explain a little bit about it?

And here is my specific question.

I have two tables, Table1 and Report1.

 

What if "Month" column in Table1 is like:

Month:

Jul

Aug

Sep

Oct

Nov

Dec

So this way Month column is sorted based on the dates. I have to filter data to not to include “Dec. And I want to select the "Nov" as the last month and count the volumes for last month which is in another table (Report1).

 

I used to solve this problem by adding a column with number in "Table1" in it as below:

Month#    Month    

1               Jul

2               Aug

3               Sep

4               Oct

5               Nov

6               Dec

 

And my other table named "Report1"

 

Report1:

Volume    Month    

4              Jul

3              Jul

2              Aug 

7              Aug

9              Aug

3              Sep

7              Oct

5              Oct

1              Nov

8              Nov

6              Dec

 

I use a measure to find the last month as:

 

LastMonth= VLOOKUP ('Table1'[Month], 'Table 1'[Month#], MAX('Table1'[Month#]))

 

Then use another measure as below:

TotalVolume= COUNTAX(FILTER('Report1','Report1'[Month]=[LastMonth]),'Report1'[Volume])

 

Measure "LastMonth" works fine itself. However, it is not working when referred in the second measure. 

I searched and see that VLOOKUP function returns a single value but do not know why its value is not working as a text value in another measure. 

 

I appreciate if you share your ideas to fix my problem. Thank you very much..

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

HI @Ynew

 

Please try this MEASURE

 

TotalVolume =
VAR mymonth = [LastMonth]
RETURN
    COUNTAX ( FILTER ( 'Report1', 'Report1'[Month] = mymonth ), 'Report1'[Volume] )

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

11 REPLIES 11

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.