简体   繁体   中英

Making a DAX statement in Power BI for counting

I'm trying to figure out DAX language for Excel and Power BI. Currently I'm facing a problem when trying to make measurements. I have 2 columns, Resign and Active. I want to count the rows where the combination is: Resign=1 and active=0. Do you know how to make this measurement?

Thanks!

Is difficult help you without any data, but if you have the Table 1 for example and the columns that you describe, can do it:

Combination = CALCULATE(COUNTROWS('Table 1'),FILTER('Table 1',AND('Table 1'[Resign]=1, 'Table 1'[Active]=0)))

Please tell me if this help you!

In this case the FILTER-function is not necessary. (referring to the accepted answer). Just using CALCULATE is more efficient. Like so:

Combination = 
     CALCULATE ( COUNTROWS ( 'Table 1' ); 'Table 1'[Resign] = 1; 'Table 1'[Active] = 0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM