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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
iozkan
Regular Visitor

Defining basis month or year and comparing

Hi guys,

 

I have a table of sales figures with dates (monthly, quarterly, yearly) and I'd like to choose a basis month or year (which will be 100 and should change according to selected month or year but basis should be 100) then compare it as in below. Many thanks!

 

Capture.JPG

2 ACCEPTED SOLUTIONS

@iozkan

 

Bascially I have used a New Table of Dates to slice the original Table

 

A New Table (Calculated Table) was created from the Modeling Tab>>> NEW TABLE

New_Table =
ALL ( TableName[Date] )

Then following MEASURE was added to Original Table

 

Index =
VAR selectedmonthSales =
    CALCULATE (
        SUM ( TableName[Sales] ),
        FILTER (
            ALL ( TableName ),
            TableName[Date] = SELECTEDVALUE ( 'New_Table'[Date] )
        )
    )
RETURN
    IF (
        SELECTEDVALUE ( TableName[Date] ) = SELECTEDVALUE ( 'New_Table'[Date] ),
        100,
        SELECTEDVALUE ( TableName[Sales] ) * 100
            / selectedmonthSales
    )

View solution in original post

@iozkan

 

Using Slicer from New Table, now you can get the required Index Measure in your Original Table

 

1026.png

View solution in original post

11 REPLIES 11
Zubair_Muhammad
Community Champion
Community Champion

@iozkan

 

Bascially I have used a New Table of Dates to slice the original Table

 

A New Table (Calculated Table) was created from the Modeling Tab>>> NEW TABLE

New_Table =
ALL ( TableName[Date] )

Then following MEASURE was added to Original Table

 

Index =
VAR selectedmonthSales =
    CALCULATE (
        SUM ( TableName[Sales] ),
        FILTER (
            ALL ( TableName ),
            TableName[Date] = SELECTEDVALUE ( 'New_Table'[Date] )
        )
    )
RETURN
    IF (
        SELECTEDVALUE ( TableName[Date] ) = SELECTEDVALUE ( 'New_Table'[Date] ),
        100,
        SELECTEDVALUE ( TableName[Sales] ) * 100
            / selectedmonthSales
    )

@iozkan

 

Using Slicer from New Table, now you can get the required Index Measure in your Original Table

 

1026.png

Many thanks! Is ALL function limited with only one year or can i add more date? I've tried this in power pivot but "a table of multiple values supplied where a single value is expected" error showed up.

Hi @iozkan

 

Where did the error show up?

 

In the NEW TABLE?

Yes, in the new table. 

 

 

Hi @iozkan

 

I believe you are doing it in Excel?

How are you creating the NEW TABLE?

 

 

@iozkan

 

In Excel you can simply copy the Dates Column from your Original table and paste it as NEW TABLE and then Add it to the DATA MODEL.

 

See the Excel file I attached above

Hi,

 

Yes I've copied the date from sales table and copied to a new sheet, added this table to the data model. When I try to add date column in pivot table below error pops up

 

Capture.JPG

 

Capture.JPGCapture.JPG

Hi @iozkan

 

Please could you upload your file to google drive or onedrive and share link here

 

I will try to fix it

Hi,

 

I have two more questions sadly.

 

I've found the problem, i had duplicate values in sales table, some products are sold in many stores. If I filter single product and store i have the values, otherwise "duplicate"problem occurs. What should I do for comparing all portfolio with index date then, I can't remove duplicate ones. (1)

 

I have 3 different date tables; sales, index, calendar. Calendar date is daily, sales date is monthly and now index date is same as sales. I also want to compare sales data quarterly, and index should be 100 for quarterly. Is it possible to use a general index date table for all dates? (2) My fx table has daily rates and if I use date and fx in pivot table, fx is listed as average and I want index date to be available for all.

 

Many many thanks.

 

 

 

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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