Forum Discussion

o59393's avatar
o59393
Icon for Post Prodigy rankPost Prodigy
6 years ago
Solved

Summarize various calculate functions into one

Hi all

 

I created 8  dax function that returns the count of ocassions the "Government time" is within:

 

0 - 30 days

30 - 60 days

60 - 90 days

90 - 120 days

120 - 150 days

150 - 180 days

180 - 210 days

210 and above

 

Example for the 180-210 days

 

 

 

CALCULATE(

COUNT('Sanitary Registration Mass Report'[Cycle Time (Process)]),FILTER('Sanitary Registration Mass Report','Sanitary Registration Mass Report'[Cycle Time (Process)]>180&&'Sanitary Registration Mass Report'[Cycle Time (Process)]<=210)

)

 

 

 

This is kinda unefficient so I wanted to know if there is a way to have in a single dax function all this bunch of dax measures.

 

I attach PBIx.

 

https://1drv.ms/u/s!ApgeWwGTKtFdhiKPn67mXUs1txlw?e=8SvWVE

 

Thanks.

  • Hi 

    o59393

     try this file https://ufile.io/whlx43iq 

    I added dimension table dimIntervals with all possible intervals and a calculated column in your table

     

    Interval = calculate(FIRSTNONBLANK(dimIntervals[Label];1); FILTER(ALL(dimIntervals); dimIntervals[MinPeriod] < 'Sanitary Registration Mass Report'[Cycle Time (Process)] && dimIntervals[MaxPeriod]>='Sanitary Registration Mass Report'[Cycle Time (Process)]) ) ​

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    LinkedIn

     

     

  • You are welcome.  If my previous reply helped, please mark that as Answer.

    ABCD is just the title of the column.  You may give any meaningful title within the double quotes.

5 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi 

    o59393

     try this file https://ufile.io/whlx43iq 

    I added dimension table dimIntervals with all possible intervals and a calculated column in your table

     

    Interval = calculate(FIRSTNONBLANK(dimIntervals[Label];1); FILTER(ALL(dimIntervals); dimIntervals[MinPeriod] < 'Sanitary Registration Mass Report'[Cycle Time (Process)] && dimIntervals[MaxPeriod]>='Sanitary Registration Mass Report'[Cycle Time (Process)]) ) ​

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    LinkedIn

     

     

  • Hi,

    You may download my PBI file from here.  I have only measures to solve this question.

    Hope this helps.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        You are welcome.  If my previous reply helped, please mark that as Answer.

        ABCD is just the title of the column.  You may give any meaningful title within the double quotes.