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
asjones
Helper IV
Helper IV

Calculated Column / Measure With filter Criteria From Secondary Table with single Row

 

 

I have a large table with many columns including  various amounts and period (year/month). I have a secondary table with a single row of various parameters about the data pull.

 

If I try and reference the period column in the secondary table in DAX then I get an error. However if I hard code the period  from the secondary table then the new column is created correctly.

 

I am not sure I am doing the DAX the best way however this seemed to work

 

This seems to work:

Amount4_YTD = CALCULATE( sum(Project_Data[plA_Amount4_Year]) , Project_Data[Award] = "AWARD1" , FILTER( Project_Data, Project_Data[period] <= 201801 ))

 

This does not work:

pla_Amount4_YTD_HFR1 = CALCULATE( sum(Project_Data[plA_Amount4_Year]) , Project_Data[Award] = "HPIAA*" , FILTER( Project_Data, Project_Data[period] <= General_Environment[cperiod] ))

 

what am I missing?

 

Thanks

 

Alan

 

 

 

 

2 REPLIES 2
mattbrice
Solution Sage
Solution Sage

Insecond measure, General_Environment[cperiod] doesn't have a row context so i would expect the calculated column to fail.  You need to wrap column in MAX, MIN, or some other scalar function.

 

Is there a relationship between the two tables? 

I don't have a relation between the two tables. The General_Environment table has 1 row and a 2nd row with nulls that is preventing PowreBI from allwoing a relation. I am having trouble keepting the nulls out everytime out of my data.

 

 

I really liked your idea of wrapping the column in max(). That did not give an error, but seemed to give no results.

Amount4_YTD_HFR2 = CALCULATE( sum(Project_Data[plA_Amount4_Year]) , Project_Data[Award] = "HPIAA*" , FILTER( Project_Data, Project_Data[period] <= max(General_Environment[cPeroid] )))

 

thanks for the response and ideas

 

Alan

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.