Forum Discussion

basirve's avatar
basirve
Icon for Helper III rankHelper III
4 years ago

Measure Is nit working in Calculated Column in DAX

Dear Experts,

Measure Is nit working in Calculated Column in DAX in Power BI.

Measure:

InDateRange =
VAR _rangeStart = MIN (Dates[Date])
VAR _rangeEnd = MAX ( Dates[Date] )
RETURN
 
if( ( ( ( SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Eff_Dt])>= _rangeStart
&& SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Disc_Dt])<=_rangeEnd )
|| (SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Eff_Dt]) >= _rangeStart
&& SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Eff_Dt])<= _rangeEnd ) )
||SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Disc_Dt])>= _rangeEnd
&& SELECTEDVALUE(Denodo_Primary_Area_Agent_Attribute[Eff_Dt]) <= _rangeStart ) ,
1,0)
 
Calculated Column: 
Test = IF([InDateRange] =1,1,0)

In my secanerio i have used only calculated column ,Could you please let me know your thoughts on this.

 

Thanks & Regards,

Venkat.

 

 

2 Replies

  • Hi basirve 

    Measures are dynamic and it will have different context based on the slicers, row etc. Please try this in measure instead of calculated column. Calculated column is static and the data will be stored and the calculations will not change based on the other selection.

    Thanks

    Hari

    Did I answer your question? Then please mark my post as the solution.
    If I helped you, click on the Thumbs Up to give Kudos.


    My Blog :: YouTube Channel :: My Linkedin


  • Anonymous's avatar
    Anonymous
    Not applicable

    HI basirve,

    In fact, measure and calculate columns work on different levels, you can't use a dynamic measure based on the filter to create dynamic calculate columns/tables.

    Notice: the data level of power bi(from parent to child level)

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng