Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Sohan
Helper III
Helper III

Total number of measure

I have the following measure that counts the number of appointments in the coming 6 months.

 

 

Rolling 6 month = CALCULATE(COUNT(Afspraken[Datum afspraak]),
DATESINPERIOD(Afspraken[Datum afspraak], TODAY(), 6, MONTH))

 

 

 

This gives the following result when date is added to the table:

Sohan_0-1626183572241.png

 

I want to see the totals. So the following:

DateNumber of appointments
13-07-20211430
14-07-20211438

 

How can I achieve this?

2 ACCEPTED SOLUTIONS
v-kkf-msft
Community Support
Community Support

Hi @Sohan ,

 

You can try the measure like this:

 

Measure = 
CALCULATE(
    SUMX( ALLSELECTED('Table'[Datum]), [Rolling 6 month] ),
    DATESINPERIOD(
        'Table'[Datum],
        MAX('Table'[Datum]),
        6,
        MONTH
    )
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Sohan ,

 

You can try to add an IF condition to these measures, like this:

 

Measure = 
IF(
    MAX('Table'[Datum]) <= TODAY(),
    CALCULATE(
        SUMX( ALLSELECTED('Table'[Datum]), [Rolling 6 month] ),
        DATESINPERIOD(
            'Table'[Datum],
            MAX('Table'[Datum]),
            6,
            MONTH
        )
    )
)

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

 

Best Regards,
Winniz

View solution in original post

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @Sohan ,

 

You can try the measure like this:

 

Measure = 
CALCULATE(
    SUMX( ALLSELECTED('Table'[Datum]), [Rolling 6 month] ),
    DATESINPERIOD(
        'Table'[Datum],
        MAX('Table'[Datum]),
        6,
        MONTH
    )
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, this works! When I try to make a line chart, I get this:

Sohan_0-1626356852884.png

 

I want to see the values up until today. When I add the date filter, I get different values. Do you know why this happens?

 

Hi @Sohan ,

 

You can try to add an IF condition to these measures, like this:

 

Measure = 
IF(
    MAX('Table'[Datum]) <= TODAY(),
    CALCULATE(
        SUMX( ALLSELECTED('Table'[Datum]), [Rolling 6 month] ),
        DATESINPERIOD(
            'Table'[Datum],
            MAX('Table'[Datum]),
            6,
            MONTH
        )
    )
)

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

 

Best Regards,
Winniz

@v-kkf-msft Thank you so much for your help! It's much appreciated!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.