cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Archana_31
New Member

reg explanation for DAX

Kindly let me know the explanation for the following DAX
 
PoInactive = IF(CALCULATE(COUNTROWS(new_revenuerecognitions),FILTER(ALLSELECTED(new_revenuerecognitions),'new_revenuerecognitions'[PO_Name] in FILTERS('new_revenuerecognitions'[PO_Name]) && 'new_revenuerecognitions'[Status]="Active" ))=0,1,-1
)
1 ACCEPTED SOLUTION
MrSujay
Resolver II
Resolver II

Your Calculated column name is - "PoInactive".

PoInactive return value 1 OR -1.

if Count of rows in new_revenuerecognitions which having status " Active" and if count = 0 then return 1 else -1 value.


CALCULATE: Evaluates an expression in a context modified by filters.

COUNTROWS : function counts the number of rows in the specified table, or in a table defined by an expression

FILTER: You can use FILTER to reduce the number of rows in the table that you are working with, and use only specific data in calculations

ALLSELECTED : ALLSELECTED function gets the context that represents all rows and columns in the query, while keeping explicit filters and contexts other than row and column filters. This function can be used to obtain visual totals in queries



PoInactive = 
IF(
   CALCULATE(
     COUNTROWS(new_revenuerecognitions), 
     FILTER(
       ALLSELECTED(new_revenuerecognitions), 
       'new_revenuerecognitions' [PO_Name] in FILTERS(
         'new_revenuerecognitions' [PO_Name]
       ) && 'new_revenuerecognitions' [Status] = "Active"
     )
   )= 0, 
  1, 
  -1
)

 

View solution in original post

1 REPLY 1
MrSujay
Resolver II
Resolver II

Your Calculated column name is - "PoInactive".

PoInactive return value 1 OR -1.

if Count of rows in new_revenuerecognitions which having status " Active" and if count = 0 then return 1 else -1 value.


CALCULATE: Evaluates an expression in a context modified by filters.

COUNTROWS : function counts the number of rows in the specified table, or in a table defined by an expression

FILTER: You can use FILTER to reduce the number of rows in the table that you are working with, and use only specific data in calculations

ALLSELECTED : ALLSELECTED function gets the context that represents all rows and columns in the query, while keeping explicit filters and contexts other than row and column filters. This function can be used to obtain visual totals in queries



PoInactive = 
IF(
   CALCULATE(
     COUNTROWS(new_revenuerecognitions), 
     FILTER(
       ALLSELECTED(new_revenuerecognitions), 
       'new_revenuerecognitions' [PO_Name] in FILTERS(
         'new_revenuerecognitions' [PO_Name]
       ) && 'new_revenuerecognitions' [Status] = "Active"
     )
   )= 0, 
  1, 
  -1
)

 

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors