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
Mstrande
Resolver I
Resolver I

Problem with month to month calculation quick formula Error message

Hi,

Realised that my problem description was bad so here is an update:

I want to use the quick formula month to month difference formula. Then I get this error in the formula:

Then I get this error:

Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.
 
When I try to mark my Table as a date table I get this error:
The date columns need unique values
The date column cannot have gaps in date
 
I found a solution . I found below but dont understand: :
In my data I only have one date in each month. I mean by project and organisation we only have data per month. I have monthly data:
 
Result dateProjectMSEK
den 15 Juni 2016A5

den 15 Januari 2016

A6
den 15 Febryary 2016A4
den 15 Mars 2016A5
 
Do I need data for every day or what?
 
Mstrande
7 REPLIES 7
v-eachen-msft
Community Support
Community Support

Hi @Mstrande ,

 

You could create a rank column based on your date column at first. Then refer to the following measure to get the result.

Column 2 =
VAR a =
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[MSEK], 1 ),
        FILTER (
            'Table',
            'Table'[rank]
                = EARLIER ( 'Table'[rank] ) - 1
                && 'Table'[Project] = EARLIER ( 'Table'[Project] )
        )
    )
RETURN
    'Table'[MSEK] - a

Here is my test file for your reference.

 

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

Hi @v-eachen-msft @amitchandak !

the quick formula only supports unique date values and I have several MSEK rows on the same date. 

Date              Project        costtype      MSEK

20200515     Chair            Manhour      5

20200515     Chair            Testobject    10

20200415     Chair          Manhour      5

20200515     Chair            Testobject    10

 

MSTRANDE

amitchandak
Super User
Super User

@Mstrande , Not sure I am clear with your issue. But make sure you have created a date table and join it with your date in your transaction table

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

 

@amitchandak 

 

Thanks for input but please see updated problem description

@Mstrande , the column in your table, is that detected as date, if no, make sure it does. Then create a date table. And use that for time intelligence. 

Create the date table using the calendar function

@amitchandakthanks for reply; The column is marked as a date. With format "den d MMMM YYYY" Please look a solution above, how does that work?

 

@Mstrande , Can you share sample data(with more rows) and sample output in table format? Or a sample pbix after removing sensitive data.

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.