Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using a DAX Count rows / Treatas measure with a subtraction element

I’m very new to DAX but I’m trying to increase my understanding on a daily basis. My current problem is that I have the following measure that allows me to show a running count of activities in a table. The data revolves around the period a piece of data was added. This works fine but i’d also like to subtract from the count the number of cancellations in that period which is in the same table under the column ‘cancelled’. The enteries in the ‘cancelled’ column also show the period when the item was cancelled, such as ‘T-3, T-2’ ETC
Can anyone help me with this subtraction element?

CountValues T-1 = 
 CALCULATE (
    COUNTROWS ( '2024-24 RAG Data' ),
    KEEPFILTERS (
        TREATAS ( { "T-4", "T-3", "T-2","T-1"}, '2024-24 RAG Data'[Period Sumitted] )
    ))

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is it not just this?

CountValues T-1 = 

VAR a = CALCULATE (
    COUNTROWS ( '2024-24 RAG Data' ),
    KEEPFILTERS (
        TREATAS ( { "T-4", "T-3", "T-2","T-1"}, '2024-24 RAG Data'[Period Sumitted] )
    ))
    
VAR b = CALCULATE (
    COUNTROWS ( '2024-24 RAG Data' ),
    KEEPFILTERS (
        TREATAS ( { "T-4", "T-3", "T-2","T-1"}, '2024-24 RAG Data'[Cancelled] )
    ))

RETURN a - b
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading