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
mrbajana
Helper III
Helper III

Show Data in Matrix until last date sale

I need to show the data Show Data in Matrix until last date sale in the last year . I need in this format, because is important at the analysis moment to compare years with only the last date of sales.

 

2020-11-10_13h28_01.png

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

Hi, @mrbajana 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

You may create a measure as below.

Visual Control = 
var m = 
CALCULATE(
    MAX('Table'[Date]),
    FILTER(
        ALL('Table'),
        'Table'[Month]=MAX('Table'[Month])
    )
)
var d = 
DATE(MAX('Table'[Year]),MONTH(m),DAY(m))
var x = MAX('Table'[Date])
return
IF(
    ISINSCOPE('Table'[Day]),
    IF(
        x<=d,
        1,0
    ),
    1
) 

 

Then you need to put the measure in the visual level filter to display the result.

c2.png

 

Best Regards

Allan

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @mrbajana 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

You may create a measure as below.

Visual Control = 
var m = 
CALCULATE(
    MAX('Table'[Date]),
    FILTER(
        ALL('Table'),
        'Table'[Month]=MAX('Table'[Month])
    )
)
var d = 
DATE(MAX('Table'[Year]),MONTH(m),DAY(m))
var x = MAX('Table'[Date])
return
IF(
    ISINSCOPE('Table'[Day]),
    IF(
        x<=d,
        1,0
    ),
    1
) 

 

Then you need to put the measure in the visual level filter to display the result.

c2.png

 

Best Regards

Allan

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@mrbajana , In case you are using date table. Assumed you current measure is measure

new measure =
var _max = format(maxx(allselected(sales), sales[sales date]), "MMDD")
return
calculate([measure], filter(Date, format(Date[Date],, "MMDD") <=_max))

 

not using sales table

new measure =
var _max = format(maxx(allselected(sales), sales[sales date]), "MMDD")
return
calculate([measure], filter(sales, format(sales[sales date],, "MMDD") <=_max))

 

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.