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
amane
Frequent Visitor

DAX NOT WORKING

I have a below measure : 

W Test 1 = CALCULATE(MAX(fact_qbrSales[Week Rank]) , FILTER(fact_qbrSales , fact_qbrSales[fiscal_start_week] < fact_qbrSales[Current_Date])) ----> This gets be the Max Week Rank
 
I have another measure : (This measure should calculate the Revenue for the week rank I dervied in above DAX but it is deriving the Revenue for all Weeks and not that particular Week whic
W Test 3 = CALCULATE(
[GNARR_CQ],
FILTER(fact_qbrSales , fact_qbrSales[Week Rank] = [W Test 1]
))
 
3 REPLIES 3
d_gosbell
Super User
Super User

The problem here is that you are referencing a measure in your filter expression and it will recalculate the max value of [Week Rank] based on the value of the [fiscal_start_week] for each row in your fact table. You can solve this by storing the value of the measure in a variable before doing calling the FILTER function

 

W Test 3 =
var _w1 = [W Test 1]
return CALCULATE(
[GNARR_CQ],
FILTER(fact_qbrSales , fact_qbrSales[Week Rank] = _w1
))

Thanks @d_gosbell That worked! 
Another issue popping up relevant to that is now when I'm using fiscal_quarter_week as a filter I'm getting blank for the below field : 

amane_0-1620262942978.png

 


@amane wrote:


Another issue popping up relevant to that is now when I'm using fiscal_quarter_week as a filter I'm getting blank for the below field : 


Without being able to see the DAX for both your measures and some example data is almost impossible tell why you are getting a blank result.

 

If you provide some test data we can play with  (see https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071... ) it should be possible to figure out what the issue is.

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.