Forum Discussion

mdaamirkhan's avatar
mdaamirkhan
Post Prodigy
4 years ago
Solved

Switch Case not working

Hi All,

 

I have need help in my Dax query below  which I have highlighted in red is not returning any value in that table

Can you help me on dax 

Selected Time Period =
VAR CurrentItem = SELECTEDVALUE( 'Time Period'[ID])
VAR CurrentItem_ = SELECTEDVALUE('wt_fin_staging pl_sorting'[Account_ (Normalized)])
RETURN
SWITCH( TRUE(),
CurrentItem_ = "Other staff costs",CALCULATE([Total Actual],FILTER(wt_fin_pl_actuals_monthly_summary,wt_fin_pl_actuals_monthly_summary[account_description] = CurrentItem_)),
CurrentItem = 1, TOTALMTD([Total Actual],'wt_fin_staging dim_date'[date].[Date]),
CurrentItem = 2, TOTALQTD([Total Actual],'wt_fin_staging dim_date'[date].[Date]),
CurrentItem = 3, [Total Actual],
CurrentItem = 4, TOTALYTD([Total Actual],'wt_fin_staging dim_date'[date].[Date])
)


  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi mdaamirkhan ,

     

    Please try to separate this part separately to test whether the result is returned.

    Selected Time Period =
    VAR CurrentItem_ = SELECTEDVALUE('wt_fin_staging pl_sorting'[Account_ (Normalized)])
    RETURN
    SWITCH( TRUE(),
    CurrentItem_ = "Other staff costs",CALCULATE([Total Actual],FILTER(wt_fin_pl_actuals_monthly_summary,wt_fin_pl_actuals_monthly_summary[account_description] = CurrentItem_)))

     

    Best Regards,

    ShundaSteph

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi mdaamirkhan ,

     

    Please try to separate this part separately to test whether the result is returned.

    Selected Time Period =
    VAR CurrentItem_ = SELECTEDVALUE('wt_fin_staging pl_sorting'[Account_ (Normalized)])
    RETURN
    SWITCH( TRUE(),
    CurrentItem_ = "Other staff costs",CALCULATE([Total Actual],FILTER(wt_fin_pl_actuals_monthly_summary,wt_fin_pl_actuals_monthly_summary[account_description] = CurrentItem_)))

     

    Best Regards,

    ShundaSteph