Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JulietZhu
Helper IV
Helper IV

Calculated column not group by dimension column

 I have task fact table and tasktype dimention table. 2 calcuated columns. Total number is correct. But group by TaskType, TashBegDay2 measure is not working and it always pickup the total number. Any thought about this. Thanks

 

 DAX for 2 measrues are below

TaskCreated = CALCULATE(DISTINCTCOUNT(Task[TaskID]))

 

TaskBegDay =
VAR _selected = SELECTEDVALUE('Date'[Date],min('Date'[Date]))
return
CALCULATE ( DISTINCTCOUNT(Task[TaskID]),filter(TaskStatus,TaskStatus[TaskStatus] in {"In Progress","Not Started"})
,FILTER(ALL(Task), _selected > Task[createddate])) 
+ CALCULATE ( DISTINCTCOUNT(Task[TaskID]),filter(TaskStatus,TaskStatus[TaskStatus] ="Completed")
,FILTER(ALL(Task), _selected > Task[createddate] && _selected <= Task[CompletedDate] ))

 7.PNG

 

Dummy data link

https://1drv.ms/u/s!AlYpYKwSuOKxhFbm7foZxBRBQYVT

1 ACCEPTED SOLUTION

@JulietZhu

 

Try this formula:

TaskBegDay2 = 
VAR _selected = SELECTEDVALUE('Date'[Date],0)
return
    CALCULATE (  
                 DISTINCTCOUNT(Task[TaskID])
                        ,filter(TaskStatus,TaskStatus[TaskStatus] in {"In Progress","Not Started"})
                        ,FILTER(ALLEXCEPT(Task, TaskType[TaskTypeCategory]), _selected > Task[createddate])
                          
              )
    +  CALCULATE (          
                 DISTINCTCOUNT(Task[TaskID])
                        ,filter(TaskStatus,TaskStatus[TaskStatus] ="Completed")
                        ,FILTER(ALLEXCEPT(Task, TaskType[TaskTypeCategory]), _selected > Task[createddate] &&  _selected <= Task[CompletedDate] )
                          )

 

Instead of ALL use ALLEEXCEPT

View solution in original post

4 REPLIES 4
JulietZhu
Helper IV
Helper IV

Please help. Thanks

@JulietZhu

 

Try this formula:

TaskBegDay2 = 
VAR _selected = SELECTEDVALUE('Date'[Date],0)
return
    CALCULATE (  
                 DISTINCTCOUNT(Task[TaskID])
                        ,filter(TaskStatus,TaskStatus[TaskStatus] in {"In Progress","Not Started"})
                        ,FILTER(ALLEXCEPT(Task, TaskType[TaskTypeCategory]), _selected > Task[createddate])
                          
              )
    +  CALCULATE (          
                 DISTINCTCOUNT(Task[TaskID])
                        ,filter(TaskStatus,TaskStatus[TaskStatus] ="Completed")
                        ,FILTER(ALLEXCEPT(Task, TaskType[TaskTypeCategory]), _selected > Task[createddate] &&  _selected <= Task[CompletedDate] )
                          )

 

Instead of ALL use ALLEEXCEPT

@themistoklis. It works. This bothered me the whole day yesteday. You are awesome.  What is difference all and allexcept. Thanks 

@JulietZhu

 

ALLEXCEPT simply excludes the specified field from the calculation of the metric 🙂

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.