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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MartaMG
New Member

How to create new table in dax only with new value comparing date to date if existe in previous date

Hi, 

I'm trying to create a new table in Power BI (not in Power Query) that will contain only those rows that are not present in the main table by comparing the list of values for each date from the main table in chronological order. I will add that the main table contains an incremental data set with an increasingly recent date, so it is a table containing an increasingly fresh state of the same data. I want to show what's new in each snapshot that wasn't in the previous drop. I tried to use PARALLELPERIOD, but my date is not cyclic so I made an index on the date to be able to compare them, but PARALLELPERIOD only uses the date format. What's more, more fresh drops will still be added, unfortunately at irregular intervals.
Below, on the left, an example of the main table and on the right, what I want to get.

Please help.

 

MartaMG_0-1669822269780.png

 

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @MartaMG ,

I have some questions. According to what you said, fgh in 2022/10/29 so it cannot appear in 2021/11/1. Why it still appears?

 

I have created a simple sample, please refer to it to see if it helps you.

Measure 2 = 
VAR _date = MAX('Table'[date])
VAR _table1 = CALCULATETABLE(VALUES('Table'[name2]),'Table'[date]=_date)
VAR _date2 = CALCULATE(MAX('Table'[date]),FILTER(ALL('Table'),'Table'[date]<MAX('Table'[date])))
VAR _table2 = CALCULATETABLE(VALUES('Table'[name2]),FILTER(ALL('Table'),'Table'[date]=_date2))
VAR _table = INTERSECT(_table1,_table2)
VAR _result = 
SWITCH(
    TRUE(),
    _date=CALCULATE(MIN('Table'[date]),ALL()),BLANK(),
    NOT MAX('Table'[name2]) IN _table,MAX('Table'[name2])
)
RETURN
_result

Then create a table.

Table 2 = CALCULATETABLE('Table',FILTER('Table',[Measure 2]<>BLANK()))

vpollymsft_0-1669862466216.png

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello, 
thank You very much. It's working as i want it. 


According to your question "I have some questions. According to what you said, fgh in 2022/10/29 so it cannot appear in 2021/11/1. Why it still appears?"  - it was my mistake in sample.

 

But i have one problem with that solution. It's killing my Power BI. I'm receivig masaage that there is not enough memory to finish that operation. I was able to implement it but now i can't do anytging in my Power BI. I alredy try it with only Power BI on. But it does't change anything, even i have computer with i7, 32 GB 😞

 

Is it posibble to optimize some how these solution?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.