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
Syndicate_Admin
Administrator
Administrator

Switching between dates and columns

Hello community!

I need your help because I have a problem that is not solved, I have tried nesting IF functions but I do not get a result, I show you below an example of the table that I have to count with 12k records and is updated daily.

JepGr_0-1644920878289.png

I would need a measurement that would tell me if the value changes between columns and days and how much value moves between columns, knowing that every month I have one more column and that every day rows are added.

Thanks in advance

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Hello, back to the matter:

In the end using the method of "Unpivot columns" I achieved this:

JepGr_0-1646050581295.png

Do you think it is possible to get a measure that indicates whether there has been a change in the "attributte" column and that returns the value of the "value" column only once? Considering that the original table has thousands of rows...

Thank you

Hi @JepGr ,

 

Add a index column in Power QuerySort in the following order in Power Query, and then add an index column.

1.png

vstephenmsft_2-1646213638201.png

 

Then you can create a measure to show the change of 'Attribute' and return the value of the 'value'.

Measure = IF(MAX('Table'[Attribute])<>CALCULATE(MAX('Table'[Attribute]),FILTER(ALL('Table'),[Index]=MAX('Table'[Index])-1)),SUM('Table'[Value]))

vstephenmsft_3-1646213832680.png

 

 

Best Regards,

Stephen Tao

 

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

Hi Sthepen!

That works!!! Thank you very much! I'm trying to add more filters to the measure (without success) in order to only run when the Sales order is the same, so in this situation the measure is not working because this is a different sales order:

JepGr_0-1646220666808.png

I try with the earlier fx inside the Calculate:

JepGr_1-1646221051792.png

What I'm doing wrong?

amitchandak
Super User
Super User

@Syndicate_Admin ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Of course you do, thank you very much

Exit:

Sales documentMoved to 22/02Moved to 22/03Moved to 22/04Moved to 22/05Moved to 22/06Moved to 22/07Moved to 22/08Moved to 22/09Moved to 22/10Moved to 22/11Moved to 22/12
778859600144150000000

0

Entrance:

Sales documentOpen 22/01Open 22/02Open 22/03Open 22/04Open 22/05Open 22/06Open 22/07Open 22/08Open 22/09Open 22/10Open 22/11Open 22/12Data Snapshot
7788596 14415,5 31/01/2022
7788596 14415,5 01/02/2022
7788596 14415,5 02/02/2022
7788596 14415,5 03/02/2022
7788596 14415,5 04/02/2022
7788596 14415,5 07/02/2022
7788596 14415,5 08/02/2022
7788596 14415,5 10/02/2022
7788596 14415,5 11/02/2022

Hi @JepGr ,

 

It is suggested to unpivot the columns to one date column.

You can select the Sales document column and select Unpivot Other Columns.

vstephenmsft_0-1645174791997.png

vstephenmsft_1-1645174985981.png

Then you can convert the Attribute column to the YearMonth column.

vstephenmsft_3-1645175360615.png

 

vstephenmsft_2-1645175352921.png

 

 

Hope it helps.

 

 

Best Regards,

Stephen Tao

 

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

 

Hi Stephen,

 

Yes, this could work, but I have this:

JepGr_0-1645175678735.png

And wants the Moved by month, sorry if I made a mistake with the explanation

 

KR

J

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.