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
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.