Forum Discussion
Need help in DAX
Request for help:
I have two columns 'type' and 'VALUES' (in screenshot) in table and another table is facttable that contains detail so that i am trying to show similer data in Calculated Column1 which will show measure only.
I have written below expresssion but I am not getting data even not getting any error. Please have a look on return condition.
Calculated Column1:= var StudentCount1 = CALCULATE ( DISTINCTCOUNT(FactGrades[DimStudentsWid]), FILTER ( VALUES( FactGrades[PercentGradeReceived]) , COUNTROWS ( FILTER ( 'DimReportingConfig', FactGrades[PercentGradeReceived] >= 'DimReportingConfig'[MinValue] && FactGrades[PercentGradeReceived] < 'DimReportingConfig'[MaxValue]&&NOT(ISBLANK(FactGrades[PercentGradeReceived])) ) ) > 0 ) ) RETURN IF ( HASONEVALUE(SelectiomTable[Type]), SWITCH ( VALUES( SelectiomTable[Type] ), "SchoolYear", CALCULATE ( StudentCount1, TREATAS ( VALUES( SelectiomTable[VALUES] ),SectionEnrollment[SchoolYear] ) ), "GradeLevel", CALCULATE ( StudentCount1, TREATAS ( VALUES( SelectiomTable[VALUES] ), SectionEnrollment[GradeLevel]) ) ),0 )
10 Replies
- v-qiuyu-msftCommunity Support
Hi TejeshGour,
Please provide some sample data of facttable, and clarify the desired output based on the data in screenshot and facttable sample data.
Best Regards,
Qiuyun Yu- TejeshGourFrequent Visitor
I am trying to create dynamic category using slicer component.
Below is expression to created table in SSAS TOM MODEL:
var Race= CROSSJOIN(ROW("Type","Race"), VALUES(DimStudents[RaceName]))
var Gender= CROSSJOIN(ROW("Type","Gender"), VALUES(DimStudents[GenderName]))
var Hispanic = CROSSJOIN(ROW("Type","Hispanic"), VALUES(DimStudents[HispanicName]))
var SchoolYear= CROSSJOIN(ROW("Type","SchoolYear"), VALUES(SectionEnrollment[LatestSchoolYear]))
var SchoolName= CROSSJOIN(ROW("Type","SchoolName"), VALUES(DimSchool[SchoolName]))
return UNION(Race,Gender, Hispanic,SchoolYear,SchoolName)- TejeshGourFrequent Visitor
SchoolYear will be fix category and remaining will be based on selection