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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Snuchiduchi
New Member

How do you exclude name columns due to inconsistent naming conventions

The database has consistent job numbers but the job names are not consistent.  

Each month as data was loaded, the job numbers remained the same (correct) but whoever loaded them put slighltly different names each month (incorrect). 

The result is that when BI compares one period to the next, it doesn't think they are the same job because the name column is always a little different. 

 

Example:

MONTH    JOB      NAME                                                   Contract       Cost to Date   Cost this Month 

JAN 2020  10000   St.Mary's Hospital Out Patient            1,000,000       100,000             100,000               

FEB 2020   10000   St.Mary's MOB Out Patient                 1,000,000       250,000             250,000

  

In this example BI thinks that the month to date costs for Feb were 250,000 because it doesn't recognize the January info as related.  The actual month to date cost in Feb was 150,000, not 250,000. 

Example measure:

MTD Cost =

Calculate(SUM('Fact Table'[Cost to Date])) - CALCULATE(SUM('Fact Table'[Cost to Date]),DATEADD(DateTable[DATE],-1,MONTH))

 

THANK YOU!

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @Snuchiduchi ,

Did I answer your question? If you can get the correct result, please accept as solution so that users with the same problem can find it quickly. 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

v-kkf-msft
Community Support
Community Support

Hi @Snuchiduchi ,

Modify the formula as:

MTD Cost = 
SUM('Fact Table'[Cost to Date]) - CALCULATE(
    SUM('Fact Table'[Cost to Date]),
    FILTER(
        ALL('Fact Table'),
        'Fact Table'[JOB] = MAX('Fact Table'[JOB])
        && MONTH('Fact Table'[Date]) = MONTH(MAX('Fact Table'[Date]))-1
        && YEAR('Fact Table'[Date]) = YEAR(MAX('Fact Table'[Date]))
    )
)

v-kkf-msft_0-1616469877220.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.

jdbuchanan71
Super User
Super User

@Snuchiduchi 

Another option is to add a calculated column to your table, this one assumes there is a date of some kind to find the first instance of the name and use it.

Names Cleaned = 
CALCULATE (
    FIRSTNONBLANK ( 'Table'[name], MIN ( 'Table'[Date] ) ),
    ALLEXCEPT ( 'Table', 'Table'[Job] )
)

jdbuchanan71_0-1616193592036.png

 

Anonymous
Not applicable

There are likely a number of ways you can solve this, but the way I would do it is, 

Duplicate the dataset, on the new dataset [Table2] Keep only "Job" and "Name", & remove duplicates on Job number column. Now you're left with a table of unique value job numbers, each with a corresponding name. 

Now just create a one to many relationships using the "Job" columns, and use the "Name" from [Table2] in your matrix. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.