Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Problem using all in a formula

Hi all,

I have troubles calculating a progress state at a certain date when another date is selected in a segment.
This is my model :

My data set can be like this :

Table follow_criticity_activity :

id_activitylib_criticitydate_end_criticity
1critic this month to do within 1 month2023/08/31
1critic last month to do within 1 month2023/07/31

 

table activity :

id_activity
1

 

planif_activity:

id_activitydate_alimprogressdate_end
12023/07/28not started2023/07/28
 

2023/07/29

not started2023/07/28
12023/07/30in progress

2023/07/28

12023/07/31in progress2023/07/28
12023/08/01finished2023/08/01

 

ref_alim :

date_alimlib_date
2023/07/282023/07/28

2023/07/28

2023/07/28
2023/07/282023/07/28
2023/07/31end of previous month
2023/08/01today

 

I have a matrix containing planif_activity table's rows, and two segments can act on it : ref_alim.lib_date (ordered by ref_alim.date_alim) and follow_criticity_activity.lib_criticity.


I want to display in the matrix a progress state (if activity is finished then 1 else 0) based on planif_activity.progress and planif_activity.date_end at the date selected on segment ref_alim.lib_date (no problem on that), and at the follow_criticity_activity.date_end_criticty wich depend on the second segment follow_criticity_activity.lib_criticity regardless of the first segment (I can't get it out).

 

For exemple, if ref_alim.lib_date='today' and follow_criticity_activity.lib_criticity='critic last month to do within 1 month', I would like to have on my matrix :

planif_activity.id_activityplanif_activity.date_endprogress state at ref_alim.lib_date='today'progress state at follow_criticity_activity.date_end_criticty where follow_criticity_activity.lib_criticity='critic last month to do within 1 month'
12023/08/0110



I tried this measure to determined if an activity is finished (=1) or not (=0) at the follow_criticity_activity.date_end_criticty :
finished_activity =
var msr_end_date =

CALCULATE(min(follow_criticity_activity[date_end_criticity]),
filter(follow_criticity_activity, follow_criticity_activity[lib_criticity]=SELECTEDVALUE(follow_criticity_activity[lib_criticity])))


return CALCULATE(Count(planif_activity[id_activity])
,FILTER(CALCULATETABLE(planif_activity, REMOVEFILTERS(ref_alim)),
planif_activity[progress])="FINISHED" && planif_activity[date_alim]=[msr_end_date ])
)

But I have two rows displayed instead of one :

planif_activity.id_activityplanif_activity.date_endprogress state at ref_alim.lib_date='today'progress state at follow_criticity_activity.date_end_criticty where follow_criticity_activity.lib_criticity='critic last month to do within 1 month'
12023/08/011 
12023/07/28 0

 

Do you have an idea how to do that ?

Thank you in advance.

Alice

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    The last two fields [progress state at ref_alim.lib_date='today'] and [progress state at follow_criticity_activity.date_end_criticty where follow_criticity_activity.lib_criticity='critic last month to do within 1 month'] are the count of activities? What's the calculation logic? Which conditions need to be fulfilled?

    The conditions should be?

    • planif_activity[progress])="FINISHED"
    • follow_criticity_activity.lib_criticity='critic last month to do within 1 month'
    • ref_alim.lib_date='today'

    Best Regards

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,


      Thank you for your reply.
      Here is my pbix file : https://we.tl/t-HWlyzNaBh0
      I want to have the progress of this configuration :

      Into this matrix at a different configuration :

       

       

      To have this result :

       

      Thank you in advance for your help.
      Alice

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi all,

     

    Does someone have an idea ?

     

    Many thanks !