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
ScottWill
Regular Visitor

Measure values not calculating correctly in a matrix

Measure values not calculating correctly in a matrix

Example:

I have created a few measures in my Inventory table

INV TenderAssignDay

INV ShipAssignDays

INV ShipTenderDays

ScottWill_0-1646426468633.png

 

In the results set above you can see the Days are calculating correctly (that is a good thing)

My issue moving forward is this:

I want to create a MATRIX visual that:

COUNTS THE VIN

SUMMERIZE THE DAYS

TOTAL THE COLUMNS

                Below is the MATRIX I tried to create (with no luck)

 

ScottWill_1-1646426468642.png

 

 

 

 

 

As you can see below

I can do this in excel with a pivot table

ScottWill_2-1646426468645.png

 

 I would like to recreate the same in Pow BI

unfortunately I currently cannot figure out how to do this in Power BI  

ScottWill_3-1646426468645.png

 

Please provide any ideas that may help me achieve my goal

 

Example of data sets both excel and power bi provided below

 

DATA in excel

ScottWill_4-1646426468650.png

 

 

Power BI detail

ScottWill_5-1646426468659.png

 

1 ACCEPTED SOLUTION

Hi @ScottWill ,

 

Please try the following formula:

 

INV ShipAssignDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( [INV ASSIGNDATE], MAX ( inventory[SHIPDATE] ), DAY )
    ),
    [diff]
)
INV ShipTenderDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( MAX ( inventory[TENDERDATE] ), MAX ( inventory[SHIPDATE] ), DAY )
    ),
    [diff]
)
INV TenderAssignDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( [INV ASSIGNDATE], MAX ( inventory[TENDERDATE] ), DAY )
    ),
    [diff]
)

vkkfmsft_0-1646714256425.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

4 REPLIES 4
ScottWill
Regular Visitor

Sky

Thank You for the reply but not exactly what I was looking for.

But I will play around with SUMX and Summarize functions.  

 

Hi @ScottWill ,

 

Please try the following formula:

 

INV ShipAssignDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( [INV ASSIGNDATE], MAX ( inventory[SHIPDATE] ), DAY )
    ),
    [diff]
)
INV ShipTenderDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( MAX ( inventory[TENDERDATE] ), MAX ( inventory[SHIPDATE] ), DAY )
    ),
    [diff]
)
INV TenderAssignDays = 
SUMX (
    SUMMARIZE (
        inventory,
        inventory[CUSTOMER CODE],
        inventory[VIN],
        "diff", DATEDIFF ( [INV ASSIGNDATE], MAX ( inventory[TENDERDATE] ), DAY )
    ),
    [diff]
)

vkkfmsft_0-1646714256425.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-kkf-msft

The code examples wowrked, Thank You 

Syk
Super User
Super User

You should check out this video - https://youtu.be/Rii_6qkLNh8

Helped me when I had similar issues!

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.