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
AnwarHabib
Frequent Visitor

How to fetch data for last week same day data only in power bi for mobile

Currently, I am fetching data by using below but it does not work for mobile version of power BI, is theie any good way to bring data for only data of same day last week, that can work in mobile also.

 

 

let
#"RetailTransactions-Previous" = let
Source = OData.Feed("https://xxxxxxxxxxxxxxxxxxxx/data", null, [Implementation="2.0"]),
RetailTransactions_table = Source{[Name="RetailTransactions",Signature="table"]}[Data],
#"Filtered Rows" = Table.SelectRows(RetailTransactions_table, each Date.IsInPreviousNDays([businessDate], 7)),
#"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each ([TransactionType] = "Sales") and ([TransactionStatus] <> "Voided")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"OperatingUnitNumber", "NetPrice", "TransactionDate"})
in
#"Filtered Rows1",
#"Removed Other Columns" = Table.SelectColumns(#"RetailTransactions-Previous",{"OperatingUnitNumber", "NetPrice", "TransactionDate", "businessDate"}),
#"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"businessDate", Order.Ascending}}),
#"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each Date.IsInPreviousNDays([businessDate], 6)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"TransactionDate"})
in
#"Removed Columns"

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @AnwarHabib 

Change your m query as below:

let
    #"RetailTransactions-Previous" =
        let
            Source = OData.Feed("https://xxxxxxxxxxxxxxxxxxxx/data", null, [Implementation="2.0"]),
            RetailTransactions_table = Source{[Name="RetailTransactions",Signature="table"]}[Data],
            #"Filtered Rows" = Table.SelectRows(RetailTransactions_table, each Date.IsInPreviousNDays([businessDate], 7)),
            #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each ([TransactionType] = "Sales") and ([TransactionStatus] <> "Voided")),
            #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"OperatingUnitNumber", "NetPrice", "TransactionDate"})
        in
            #"Filtered Rows1",
    #"Removed Other Columns" = Table.SelectColumns(#"RetailTransactions-Previous",{"OperatingUnitNumber", "NetPrice", "TransactionDate",   "businessDate"}),
    #"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"businessDate", Order.Ascending}}),
    #"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each Duration.Days(Date.From(DateTime.LocalNow()) - [businessDate])=7),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"TransactionDate"})
in
    #"Removed Columns"

Here is a demo .

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi , @AnwarHabib 

Change your m query as below:

let
    #"RetailTransactions-Previous" =
        let
            Source = OData.Feed("https://xxxxxxxxxxxxxxxxxxxx/data", null, [Implementation="2.0"]),
            RetailTransactions_table = Source{[Name="RetailTransactions",Signature="table"]}[Data],
            #"Filtered Rows" = Table.SelectRows(RetailTransactions_table, each Date.IsInPreviousNDays([businessDate], 7)),
            #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each ([TransactionType] = "Sales") and ([TransactionStatus] <> "Voided")),
            #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"OperatingUnitNumber", "NetPrice", "TransactionDate"})
        in
            #"Filtered Rows1",
    #"Removed Other Columns" = Table.SelectColumns(#"RetailTransactions-Previous",{"OperatingUnitNumber", "NetPrice", "TransactionDate",   "businessDate"}),
    #"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"businessDate", Order.Ascending}}),
    #"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each Duration.Days(Date.From(DateTime.LocalNow()) - [businessDate])=7),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"TransactionDate"})
in
    #"Removed Columns"

Here is a demo .

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi , @AnwarHabib 

Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread?

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Super User
Super User

I'm not clear on this one, are you saying that you are writing queries in Power BI Mobile?

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.