Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have a table as shown in the pic1. I want to visualize the number of tasks per team and have a week slicer where I can select each week (pic2). It works normally but one thing I want to do is to show the data of the last week if I do not select anything from the slicer. I have written the following measure but it does not work. Another problem is that total row does not show the correct number if nothing is selected from the slicer. But it shows the correct number if I select one of the weeks from the slicer. Can you please help with the measure and this total row problem?
Thank you in advance!
Number of tasks =
IF(
CALCULATE (DISTINCTCOUNT ('Tasks'[Week of Year]),
ALLSELECTED ( 'Tasks'[Week of Year])
) = CALCULATE ( DISTINCTCOUNT ('Tasks'[Week of Year]),
ALL ( 'Tasks')
),
CALCULATE(COUNTROWS('Tasks'),'Tasks'[Status] = "Implemented",
FILTER('Tasks','Tasks'[Week of Year] = MAX(Tasks[Week of Year])
)
),
CALCULATE(COUNTROWS('Tasks'),'Tasks'[Status] = "Implemented")
)
Solved! Go to Solution.
Hi @Anonymous ,
You may create measures like DAX below, and display [Number of tasks New] in your Table visual to replace the original measure.
Number of tasks= CALCULATE(COUNTROWS('Tasks'),FILTER('Tasks', 'Tasks'[Status] = "Implemented" &&'Tasks'[Week of Year] = MAX(Tasks[Week of Year])))
Number of tasks New=
Var _table = SUMMARIZE('Tasks',[Team],"_Value",[Number of tasks])
Var _SumTotal= IF(HASONEVALUE([Team]),[Number of task],SUMX(_table,[_Value]))
Var _LastWeek= CALCULATE(MAX( 'Tasks'[Week of Year]), ALLSELECTED( 'Tasks'[Week of Year]))
Var Data_LastWeek=CALCULATE ('Tasks'[Number of tasks], FILTER ( ALLSELECTED( 'Tasks'), 'Tasks'[Status] = "Implemented" && 'Tasks'[Week of Year] =_LastWeek ))
Return
IF( ISFILTERED('Tasks'[Week of Year] ), _SumTotal , Data_LastWeek)
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You may create measures like DAX below, and display [Number of tasks New] in your Table visual to replace the original measure.
Number of tasks= CALCULATE(COUNTROWS('Tasks'),FILTER('Tasks', 'Tasks'[Status] = "Implemented" &&'Tasks'[Week of Year] = MAX(Tasks[Week of Year])))
Number of tasks New=
Var _table = SUMMARIZE('Tasks',[Team],"_Value",[Number of tasks])
Var _SumTotal= IF(HASONEVALUE([Team]),[Number of task],SUMX(_table,[_Value]))
Var _LastWeek= CALCULATE(MAX( 'Tasks'[Week of Year]), ALLSELECTED( 'Tasks'[Week of Year]))
Var Data_LastWeek=CALCULATE ('Tasks'[Number of tasks], FILTER ( ALLSELECTED( 'Tasks'), 'Tasks'[Status] = "Implemented" && 'Tasks'[Week of Year] =_LastWeek ))
Return
IF( ISFILTERED('Tasks'[Week of Year] ), _SumTotal , Data_LastWeek)
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous here are some links to work with week calculations
https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
116 | |
101 | |
74 | |
70 | |
49 |
User | Count |
---|---|
146 | |
107 | |
106 | |
89 | |
65 |