Forum Discussion
InsureBI
9 years agoAdvocate II
Multiple Filters COUNTROWS - Too Few Arguments Passed
I have a "Policy" table with the following information: Policy No., Issued_Date, Premium, Policy_Type 10001,1/1/2016,250,P 10002,1/1/2016,300,P 10003,1/2/2016,260,S 10004,1/2/2016,320,P 1000...
- 9 years ago
In addition to ankitpatira's solution, you should be able to create a measure to calculate the cumulative number of policies (or records) by issued date and by policy type as you mentioned above. The formulas below are for your reference.
Cuml_Pol_Count_P = CALCULATE ( IF ( ISBLANK ( COUNTROWS ( Policy ) ), 0, COUNTROWS ( Policy ) ), FILTER ( ALLSELECTED ( Policy ), Policy[ISSUED_DATE] <= MAX ( Policy[ISSUED_DATE] ) && Policy[POLICY_TYPE] = "P" ) )
Cuml_Pol_Count_S =
CALCULATE (
IF ( ISBLANK ( COUNTROWS ( Policy ) ), 0, COUNTROWS ( Policy ) ),
FILTER (
ALLSELECTED ( Policy ),
Policy[ISSUED_DATE] <= MAX ( Policy[ISSUED_DATE] )
&& Policy[POLICY_TYPE] = "S"
)
)Following is the result of the measures in report.
Regards
ankitpatira
9 years agoCommunity Champion
InsureBI You can do that by going to power bi desktop query editor -> right click your original table and create duplicate -> remove column Premium -> hightlight column Policy_Type and under Transform tab clikc Pivot column -> under Values select Policy_no and under Advanced option select Count(All). This will give you table in your preferred output.