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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kousar99
Helper I
Helper I

to dax conversion and suggest what kind of charts can use in dektop

Hi Experts,

I am facing an issue while converting the below SQL query into Dax .can you please help me to convert the query.

and suggest to me what kind of charts can be used for it on bi desktop.

 

select count(*) as Total,substr(nextrenewaldate,1,7) as year_month

from lei_user.gleif_leis_v21

where managingglou='EVK05KS7XY1DEII'

AND substr(initialregistrationdate,1,7)<'2019-07'

AND substr(nextrenewaldate,1,7) IN('2020-07','2020-08','2020-09')

Group by substr(nextrenewaldate,1,7);

 

 

Thanks in advance,

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

Hi, @kousar99 ;

You could create a column as follow:

year_month =
IF (
    [managingglou] = "EVK05KS7XY1DEII"
        && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
        && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" },
    MID ( [nextrenewaldate], 1, 7 )
)

Then create a measure 

total =
CALCULATE (
    COUNTROWS ( table ),
    FILTER (
        ALL ( table ),
        [year_month]= MAX ([year_month])
                    && [managingglou] = "EVK05KS7XY1DEII"
                    && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
                    && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" }))

Or create a column.

total =
CALCULATE (
    COUNTROWS ( table ),
    FILTER (
        ALL ( table ),
        [year_month] = EARLIER ( [year_month] )
            && [managingglou] = "EVK05KS7XY1DEII"
            && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
            && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" }
    )
)


Best Regards,
Community Support Team _ Yalan Wu
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

8 REPLIES 8
mnskr2024
New Member

The bigger and better thing is that I found this useful; you may check it out here: https://arunanex.com/

v-yalanwu-msft
Community Support
Community Support

Hi, @kousar99 ;

You could create a column as follow:

year_month =
IF (
    [managingglou] = "EVK05KS7XY1DEII"
        && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
        && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" },
    MID ( [nextrenewaldate], 1, 7 )
)

Then create a measure 

total =
CALCULATE (
    COUNTROWS ( table ),
    FILTER (
        ALL ( table ),
        [year_month]= MAX ([year_month])
                    && [managingglou] = "EVK05KS7XY1DEII"
                    && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
                    && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" }))

Or create a column.

total =
CALCULATE (
    COUNTROWS ( table ),
    FILTER (
        ALL ( table ),
        [year_month] = EARLIER ( [year_month] )
            && [managingglou] = "EVK05KS7XY1DEII"
            && MID ( [initialregistrationdate], 1, 7 ) < "2019-07"
            && MID ( [nextrenewaldate], 1, 7 ) IN { "2020-07", "2020-08", "2020-09" }
    )
)


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

BeaBF
Memorable Member
Memorable Member

@kousar99 Hi!

Can you paste some sample data? 

 

BF

Hi,

I just need an idea of what kinda function can be used for that query and later ill paste some sample data

@kousar99  You can use the SQL Query as-is to extract data from your DB or you can do some steps in the Power Query to transform extracted data and then load them into the model or you can load your data and then calculated a table from the native one with these characteristics. 

What do you want to do? The request is too general.

 

BF.

Hi,

Thanks for the response.

Please can u share a few samples for creating reports for LEIs renewal summary? 

@kousar99  i found this guide: https://sonra.io/xml/converting-lei-xml-data-to-power-bi/

 

hope this will help u! if you have any question, write me!

 

BF

Hi Thanks for the response,

If you have any other material or videos ,kindly share with me

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.