Forum Discussion
Count Of Drivers
- 1 year ago
Suhel_Ansari - this should work for both a column and a measure. Just replace Table with your table name:
CALCULATE(COUNTROWS( Table), ALLEXCEPT(Table, Table[Driver Name] ))If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
- 1 year ago
Hi Suhel_Ansari
Create Calculated column in the Fact_Contracts tableDriver Contract Count = CALCULATE(COUNTROWS(Fact_Contracts), ALLEXCEPT(Fact_Contracts, Fact_Contracts[Driver_key]))
and create measure in the Dim_Driver table
Driver Count(M) = IF(HASONEVALUE(Fact_Contracts[Driver_key]), //True Result CALCULATE(COUNTROWS(Fact_Contracts), FILTER(ALL(Fact_Contracts),Fact_Contracts[Driver_key] = MAX(Fact_Contracts[Driver_key]))), //False Result SUMX(VALUES(Fact_Contracts[Driver_key]), CALCULATE(COUNTROWS(Fact_Contracts))) )I am also attaching a .pbix file for your reference.
https://drive.google.com/file/d/1MHPeKgVecPhIaFDpby81DQg8G2nbVrgZ/view?usp=sharingThanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
Hi Suhel_Ansari,
Could you please share the .pbix file with some sample data to understand the relationship b/w the two tables.