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

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.

Reply
Anonymous
Not applicable

No values on stacked area chart (instead of 0)

I have problem with stacked area chart. When measure return blank values when there is no values on plot:

 

Capture.PNG

 

My measure: 

%_Time_avg_per_case_in_hours =

DIVIDE ([Time_avg_per_case_in_hours], (
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Productive")) +
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Unproductive"))),0)
 
I tried different options:

%_Time_avg_per_case_in_hours =

DIVIDE ([Time_avg_per_case_in_hours], (
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Productive")) +
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Unproductive"))),0) + 0
 

%_Time_avg_per_case_in_hours =

DIVIDE (IF( ISBLANK([Time_avg_per_case_in_hours]),0, [Time_avg_per_case_in_hours], (
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Productive")) +
CALCULATE([Time_avg_per_case_in_hours], FILTER(ALL(tasks), tasks[task productivity] = "Unproductive"))),0) + 0
 
but it is not working and returns:
Capture1.PNG
 
 
 
Do you have idea why is not working?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

The solution is below:

 

%_Time_avg_per_case_in_hours =
DIVIDE (    

        IF(
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive")) = BLANK() &&
            CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")) <> BLANK ())
            ||          
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive"))<> BLANK() &&
            CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")) = BLANK ());         
            [Time_avg_per_case_in_hours] + 0;           
            [Time_avg_per_case_in_hours]);
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive")) + CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")))
        ;0)

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

You need to create a dim date table and then create a relationship with tasks table by date column and use date column from dim date table for the x-axis value, then it should be ok.

If not your case, please share your sample pbix file for us have a test, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-lili6-msft,

 

Thanks for answer. I already created date table:

 

Untitled.png

 

I added "+0and the measure is calculated properly but it still need to be changed because on chart we see dates (start of the week) where we do not have any tasks (in time record table - it is fact table):

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Tasks occures in third quarter:

 

 

Capture.PNG

 

Chart:

Untitled.png

 

 

Start of Week = Dates[date_date]-WEEKDAY(Dates[date_date];2) + 1
 
%_Time_avg_per_case_in_hours =
DIVIDE ([Time_avg_per_case_in_hours]; (
CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive")) +
CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")));0) +0
 

 

hi @Anonymous 

If possible, could you share us a simple sample pbix file for us have a test?

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

The solution is below:

 

%_Time_avg_per_case_in_hours =
DIVIDE (    

        IF(
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive")) = BLANK() &&
            CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")) <> BLANK ())
            ||          
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive"))<> BLANK() &&
            CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")) = BLANK ());         
            [Time_avg_per_case_in_hours] + 0;           
            [Time_avg_per_case_in_hours]);
            (CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Productive")) + CALCULATE([Time_avg_per_case_in_hours]; FILTER(ALL(tasks); tasks[task productivity] = "Unproductive")))
        ;0)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.