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

show item with no data and exclude Date filter

Hi all

 

I have two table Target and sales

 

ProductTarget
A50
B25
C30
D10

 

 

Sales DateProduct Sales
2/1/2018A2
2/2/2018B4
2/3/2018A1
2/4/2018B5
2/5/2018A7
2/6/2018B5
2/7/2018A2
2/8/2018B4
2/9/2018A1
2/10/2018B1
2/11/2018A3
2/12/2018B2
2/13/2018A3
2/14/2018B2
2/15/2018A3
2/16/2018B1
2/17/2018A2
2/18/2018B1

 

 

I want to show a table like below image 

  1. If I select "sales date" from 15 to 18 then it wants to show A=5, B=2, C=0, D=0 in "Sales Count Based on Date Selection field"
  2. at the same time, it wants to show A=24, B=25, C=0, D=0 in "Overall sales count field"

Screenshot_11.png

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a new table

Date Table = CALENDARAUTO()

don't connect this table to any other table.

4.png

 

create measures in "Target" table

overall sales =
VAR overall =
    CALCULATE (
        SUM ( sales[Sales] ),
        FILTER ( ALL ( sales ), sales[Product ] = MAX ( sales[Product ] ) )
    )
RETURN
    IF ( overall <> BLANK (), overall, 0 )



based on date = VAR count1 = CALCULATE ( SUM ( sales[Sales] ), FILTER ( ALL ( sales ), sales[Product ] = MAX ( sales[Product ] ) && sales[Sales Date] >= MIN ( 'Date Table'[Date] ) && sales[Sales Date] <= MAX ( 'Date Table'[Date] ) ) ) RETURN IF ( count1 <> BLANK (), count1, 0 )

 

3.png

 

 

Best Regards

Maggie

 

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

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a new table

Date Table = CALENDARAUTO()

don't connect this table to any other table.

4.png

 

create measures in "Target" table

overall sales =
VAR overall =
    CALCULATE (
        SUM ( sales[Sales] ),
        FILTER ( ALL ( sales ), sales[Product ] = MAX ( sales[Product ] ) )
    )
RETURN
    IF ( overall <> BLANK (), overall, 0 )



based on date = VAR count1 = CALCULATE ( SUM ( sales[Sales] ), FILTER ( ALL ( sales ), sales[Product ] = MAX ( sales[Product ] ) && sales[Sales Date] >= MIN ( 'Date Table'[Date] ) && sales[Sales Date] <= MAX ( 'Date Table'[Date] ) ) ) RETURN IF ( count1 <> BLANK (), count1, 0 )

 

3.png

 

 

Best Regards

Maggie

 

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

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.