Forum Discussion
Support with DAX Function NOT Working
Hi Community,
Need your! Can anyone tell me why when I do not have a selection on the two VAR below 'aaa' and 'bbb', my chart is blank?
Can I get anyone's support to adjust the function in order to have the bit "VAR SUM_ORC = CALCULATE(SUM(t_Incorridas_SGC[Incorridas_Totais_Recurso]))" working, even if there are no selections at all?
Thank you so much!
Anonymous Guess, you are looking for a Measure something like this... Show the relevant sum while there is a selection and if there is no selection then show total sum.
Test232 = VAR _SelectedSUM = CALCULATE(SUM(emp[sal]),FILTER(emp,emp[deptno] = SELECTEDVALUE(emp[deptno]))) VAR _TotalSUM = SUM(emp[sal]) RETURN IF(ISBLANK(_SelectedSUM),_TotalSUM,_SelectedSUM)
8 Replies
- yelsherifResolver IV
so theThe first VAR seems to be incorrect
VAR bbb = CALCULATE(SELECTEDVALUE(t_Detalhe_Processos_Fases_Tarefas[Ref_GIP]))It will always return blank if nothing is selected in t_Detalhe_Processos_Fases_Tarefas[Ref_GIP] and so the filter will return a blank set of rows, resulting in a blank chart
I think you need to change the logic of VAR bbb
- AnonymousNot applicable
Thank you!
- PattemManoharCommunity Champion
Anonymous Guess, you are looking for a Measure something like this... Show the relevant sum while there is a selection and if there is no selection then show total sum.
Test232 = VAR _SelectedSUM = CALCULATE(SUM(emp[sal]),FILTER(emp,emp[deptno] = SELECTEDVALUE(emp[deptno]))) VAR _TotalSUM = SUM(emp[sal]) RETURN IF(ISBLANK(_SelectedSUM),_TotalSUM,_SelectedSUM)
- AnonymousNot applicable
Smooth!
Thanks a lot for your help.
- AnonymousNot applicable
Hi there,
Actually I found a small issue with the behaviour that it turned out.
With your logic applied, I was able to retrieve data even if no selections were made, however, when making a selection by month, it will not give values for that particular month, instead it retrieves the sum of it.
TEST =
VAR _SelectedSUM = CALCULATE(SUM(t_Incorridas_SGC[Incorridas_Totais_Recurso]);FILTER(t_Detalhe_Processos_Fases_Tarefas;t_Detalhe_Processos_Fases_Tarefas[Data_Info] = SELECTEDVALUE(t_Detalhe_Processos_Fases_Tarefas[Data_Info]));FILTER(t_Detalhe_Processos_Fases_Tarefas; t_Detalhe_Processos_Fases_Tarefas[Ref_GIP] = SELECTEDVALUE(t_Detalhe_Processos_Fases_Tarefas[Ref_GIP])))VAR _TotalSUM = SUM(t_Incorridas_SGC[Incorridas_Totais_Recurso])RETURN IF(ISBLANK(_SelectedSUM);_TotalSUM;_SelectedSUM)- AnonymousNot applicable
Can you support, please PattemManohar ?