Tag: Power BI

  • Direct Lake — Performance Optimization, Limitations & Real-World Use Cases

    Section 9 — Performance Optimization for Direct Lake

    Direct Lake is fast — but you can make it even faster. The following practices help you squeeze the maximum performance out of your Direct Lake models.

    Optimize Delta Tables

    Optimize your underlying Delta tables to keep query performance high. Focus on Z-Order, file compaction, partition pruning, schema evolution handling, and vacuuming old files.

    Use Proper Partitioning

    Use meaningful partitioning strategies that match your query patterns. Common and effective options include partitioning by date, region, category, and business keys.

    Avoid Tiny Files

    Avoid tiny files that slow down query performance and increase overhead. Use compaction to merge small files into fewer, larger files.

    Use Gold Tables for BI

    Use Direct Lake only on curated, analytics-ready data. Never point Direct Lake at Bronze or Silver tables — always use Gold tables for business intelligence workloads.

    Use Aggregations

    Leverage aggregations to accelerate common queries. Fabric supports aggregation tables, allowing you to pre-summarize data and reduce the workload on detailed fact tables.

    Use a Star Schema

    Design your model using a star schema. Direct Lake works best with well-defined fact tables, dimension tables, and surrogate keys.

    Avoid Wide Tables

    Avoid wide tables that contain many columns. Keep fact tables narrow to improve performance and simplify your model.

    Section 10 — Limitations of Direct Lake (Honest Truth)

    Direct Lake is powerful — but not perfect. Understanding its limitations helps you design solutions that work with, not against, the platform.

    Requires Delta Tables

    Direct Lake requires Delta tables. Only Delta is supported as a source format.

    Requires OneLake

    Direct Lake requires OneLake as the storage foundation. External sources must use shortcuts to participate in the architecture.

    Requires Gold-Quality Data

    Direct Lake expects clean, conformed, Gold-quality data. It is designed for well-modeled, production-ready datasets rather than raw landing zones.

    Some Advanced DAX Features May Fall Back to Import

    Some advanced DAX features may fall back to Import mode. This behavior is rare, but it is possible in specific scenarios.

    Large Models Require Careful Design

    Large models demand careful design to perform well. A robust star schema is essential to keep performance and manageability under control.

    Section 11 — Real-World Use Cases

    Direct Lake shines in real-world scenarios that demand timeliness, accuracy, and simplicity.

    • Real-Time Sales Dashboards — Updates instantly as transactions land.
    • Operational Monitoring — Event Streams → Direct Lake → Dashboard.
    • Supply Chain Visibility — Track inventory, shipments, and delays in real time.
    • Financial Reporting — No refresh cycles. No data duplication. Always accurate.
    • Customer Analytics — Unified view across systems.

    Section 12 — Why Direct Lake Is the Future of Power BI

    Direct Lake solves the biggest BI challenges: refresh cycles, data duplication, latency, complexity, and governance fragmentation.

    By doing this, it transforms Power BI from a BI tool into a real-time enterprise analytics engine.

    Conclusion — The BI Revolution Has Already Begun

    Direct Lake represents a fundamental shift in how organizations build analytics systems. It eliminates refresh cycles, removes data duplication, and delivers real-time performance at enterprise scale.

    It is the missing piece that finally unifies data engineering, data warehousing, business intelligence, real-time analytics, and governance into a single, cohesive platform.

    Direct Lake is the breakthrough that makes Microsoft Fabric the most complete analytics platform ever built. And this is only the beginning — organizations that embrace Direct Lake today are already stepping into the next era of BI, where data is always fresh, models are always aligned, and insights are always ready when the business needs them.

  • OneLake for BI, Engineering, Warehousing, Real-Time & Governance — The Complete Picture

    ← Back to Microsoft Fabric — Complete Learning Series

    OneLake for BI — The Direct Lake Revolution

    Power BI traditionally required import mode, refresh cycles, incremental refresh logic, and significant data duplication.

    With OneLake and Direct Lake, there is no refresh, no duplication, no incremental logic, no scheduled jobs, and no latency.

    Power BI reads Delta tables directly from OneLake, transforming BI into a real-time analytics engine.

    OneLake for Data Engineering

    Data engineers benefit massively from OneLake:

    • Medallion architecture with Bronze → Silver → Gold stored in OneLake.
    • PySpark notebooks to transform Delta tables directly.
    • Pipelines to ingest raw data into Bronze.
    • SQL endpoint to query Silver and Gold tables.
    • Delta optimization with Z-Order, compaction, and partitioning.

    OneLake becomes the center of all engineering workflows.

    OneLake for Data Warehousing

    Fabric Warehouse stores data in OneLake as Delta tables.

    The benefits include SQL and Spark on the same data, no ETL between lake and warehouse, no duplication, unified governance, unified security, and Direct Lake BI.

    This is the first time a warehouse and lake share the same storage layer.

    OneLake for Real-Time Analytics

    Event Streams write streaming data directly into OneLake.

    The real-time architecture is simple and powerful: Event Streams → OneLake → Direct Lake → Dashboard.

    This enables operational dashboards, real-time monitoring, IoT analytics, fraud detection, and supply chain visibility, all without separate streaming infrastructure.

    OneLake Governance — Purview Integration

    Purview governs OneLake centrally.

    Key capabilities include lineage, sensitivity labels, access control, classification, audit logs, and policy enforcement.

    This matters because governance is no longer scattered across Dataflows, Warehouses, Lakes, BI models, and ML environments. Everything is governed in one place.

    OneLake Workspace Strategy — The Enterprise Backbone

    A strong workspace strategy is essential.

    Best practices include Dev/Test/Prod separation, clear ownership, naming conventions, RBAC roles, deployment pipelines, cost management, and artifact organization.

    With the right approach, workspaces keep OneLake clean, scalable, and secure.

    OneLake Performance Optimization

    To maximize performance, focus on the following areas:

    • Partitioning — partition by date, region, and category.
    • Delta optimization — Z-Order, file compaction, vacuum, and schema evolution handling.
    • Avoid tiny files — use compaction to merge small files.
    • Use Gold tables for BI — never point Direct Lake at Bronze or Silver.
    • Use a star schema — fact and dimension tables.
    • Use aggregations — Fabric supports aggregation tables.

    Real-World OneLake Use Cases

    Real-world use cases for OneLake include:

    • Enterprise data lake modernization to replace multiple lakes with OneLake.
    • Real-time sales dashboards powered by Direct Lake and Event Streams.
    • Supply chain visibility through unified data across warehouses, ERP, and IoT.
    • Financial reporting with a single source of truth.
    • Customer 360 solutions with unified customer data across systems.

    Conclusion — OneLake Is the Foundation of the Unified Future

    OneLake is not just storage; it is the foundation of Microsoft Fabric's unified analytics platform.

    It replaces fragmented architectures with one lake, one security model, one governance layer, one storage format, and one experience.

    OneLake enables faster development, lower costs, real-time insights, simplified architecture, higher performance, stronger collaboration, and enterprise scalability.

    OneLake is the backbone of the future, and organizations that adopt it early will define the next decade of data innovation.

    ← Back to Microsoft Fabric — Complete Learning Series

  • Direct Lake — Why It’s the Future of Power BI & Enterprise Analytics

    ← Back to Microsoft Fabric — Complete Learning Series

    Direct Lake for Power BI: Conclusion and Big Picture

    This post wraps up our five-part series on Direct Lake in Microsoft Fabric. We have explored what Direct Lake is, how it works, where it shines, and what it changes for data engineering and BI teams. In this final article, we step back from the details, connect the dots, and look at what Direct Lake really means for your organization over the long term.

    Why Direct Lake Is the Future of Power BI

    Direct Lake solves the biggest BI challenges that have existed for over a decade and have shaped how teams design, build, and operate analytics systems. Instead of working around the limits of traditional import and DirectQuery models, Direct Lake fundamentally changes the model architecture.

    With Direct Lake:

    • Refresh cycles are eliminated entirely.
    • Data duplication disappears because Power BI stores only metadata while the data itself lives once in OneLake.
    • Latency drops dramatically as dashboards reflect Delta table updates almost instantly.
    • Complexity is reduced because you no longer need dataflows, import datasets, refresh pipelines, or incremental refresh logic just to keep data current.
    • Costs come down, as there is no need to pay for duplicated storage and redundant compute across multiple copies of the same data.
    • Governance fragmentation is removed because Purview governs everything centrally in one place.

    The result is a transformation of Power BI from a reporting and dashboarding tool into a real-time enterprise analytics engine. This is not an incremental optimization or a new checkbox in a dataset setting; it is a paradigm shift in how BI models relate to the underlying data platform.

    The Bigger Picture: What Direct Lake Means for the Enterprise

    Direct Lake is not just another feature in Power BI. It is the bridge that finally connects the full analytics stack into a single, coherent platform. Instead of treating data engineering, warehousing, BI, and real-time analytics as separate worlds, Direct Lake allows them to meet on the same data foundation.

    With Direct Lake in Microsoft Fabric, you can align:

    • Data engineering: Lakehouses, Spark, and pipelines that land and transform data in Delta tables in OneLake.
    • Data warehousing: Fabric Warehouse and SQL endpoints that serve structured, governed data for analytical workloads.
    • Business intelligence: Power BI semantic models that connect directly to Delta tables via Direct Lake without duplication.
    • Real-time analytics: Event Streams that write into OneLake, instantly surfacing in Direct Lake models and dashboards.
    • Governance: Purview, sensitivity labels, and lineage that apply consistently across the entire stack.

    For the first time, all of these workloads can share the same data, the same storage layer, and the same governance model. There is no need for multiple data copies, nightly refresh cycles, or parallel governance frameworks for different tools. Instead, you get one cohesive platform that reduces silos and keeps everyone working from a single source of truth.

    Who Should Adopt Direct Lake — and When?

    When Direct Lake Is the Right Choice

    Direct Lake is a strong fit when your organization is leaning into Fabric as its strategic analytics platform and wants to simplify the path from raw data to trusted insights. In particular, Direct Lake is the right choice when:

    • You are using Microsoft Fabric as your primary analytics platform.
    • Your data already lives in OneLake as Delta tables, or you are actively moving data into OneLake.
    • You need real-time or near-real-time dashboards where freshness is measured in seconds or minutes, not hours.
    • Your datasets are large, reaching hundreds of millions to billions of rows where traditional import models become fragile or expensive.
    • You want to eliminate scheduled refresh jobs and incremental refresh complexity from your operational runbook.
    • You are aiming for a single source of truth that spans BI, data engineering, and warehousing rather than maintaining duplicate data stacks.

    In these scenarios, Direct Lake gives you simpler operations, better performance, and a much cleaner alignment between data engineering and BI.

    When Direct Lake May Not Be the Best Fit (Yet)

    There are also situations where Direct Lake may not be the right answer today, or where it makes sense to wait while capabilities continue to mature. Direct Lake may not be ideal when:

    • Your data lives entirely outside OneLake with no practical shortcut path, and moving it would be a major project.
    • You depend heavily on specific advanced DAX features that currently trigger fallback to Import mode and you are not ready to adjust those patterns.
    • You are working with very small, infrequently updated datasets where a simple Import model is easy to manage and meets all your needs.

    In these cases, it can be perfectly reasonable to continue using Import or DirectQuery while you plan a broader move to Fabric and OneLake. Direct Lake does not have to be an all-or-nothing decision; you can adopt it first in the scenarios where it delivers the most value.

    The Road Ahead for Direct Lake

    Direct Lake is already reshaping how organizations think about Power BI and Fabric, and Microsoft continues to invest aggressively in this capability. As the platform evolves, you can expect Direct Lake to cover more use cases, handle more complex models, and integrate even more deeply across Fabric.

    Some of the key areas to watch include:

    • Broader DAX feature coverage, which will reduce fallback scenarios and let more models run natively in Direct Lake.
    • Enhanced support for cross-workspace Direct Lake models, giving you more flexibility in how you structure and share semantic models.
    • Deeper integration with Fabric Real-Time Intelligence, helping you turn event streams into live dashboards with minimal friction.
    • Improved tooling for monitoring and optimizing Direct Lake model performance so that operations teams can manage these models with confidence.

    All of this points toward a future where Direct Lake is not a niche option but the default way to build enterprise Power BI models in Fabric.

    Conclusion: The BI Revolution Has Already Begun

    Direct Lake represents a fundamental shift in how organizations design and operate analytics systems. By eliminating refresh cycles, removing data duplication, and delivering real-time performance at enterprise scale, it breaks through long-standing constraints that have shaped BI architectures for years.

    It is the missing piece that finally unifies data engineering, data warehousing, business intelligence, real-time analytics, and governance into a single, cohesive platform. Instead of stitching together multiple tools and data copies, you can build around OneLake and let Direct Lake semantic models sit directly on top of your core data assets.

    Direct Lake is the breakthrough that makes Microsoft Fabric one of the most complete analytics platforms available. And this is only the beginning. Organizations that embrace Direct Lake today are already stepping into the next era of BI, where data is always fresh, models are always aligned, and insights are always ready when the business needs them.

    What’s Next: Explore the Rest of the Direct Lake Series

    If you arrived here first, you may want to go back and work through the rest of the series to get the full picture. Each article builds on the last, walking from fundamentals through architecture and implementation details to the strategic view you have just read.

    • Part 1 — Introduction to Direct Lake and Why It Matters: [Link to Part 1]
    • Part 2 — Direct Lake Architecture and How It Works: [Link to Part 2]
    • Part 3 — Designing Data Models and Pipelines for Direct Lake: [Link to Part 3]
    • Part 4 — Operationalizing Direct Lake in Production: [Link to Part 4]

    Together, these posts provide a roadmap for moving from traditional BI to a Direct Lake-first approach in Microsoft Fabric. Use them as a guide to plan pilots, modernize existing solutions, and bring your organization into the era of real-time, unified analytics.

    ← Back to Microsoft Fabric — Complete Learning Series

  • Microsoft Fabric — A New Era of Unified Analytics

    ← Back to Microsoft Fabric — Complete Learning Series

    For more than a decade, organizations have struggled with fragmented analytics ecosystems. Data lakes lived in one place, warehouses in another. BI tools required separate refresh cycles. Governance was scattered across services. Real‑time analytics demanded yet another specialized stack. Every team worked in its own silo, stitching together tools that were never designed to operate as one.

    Microsoft Fabric changes that paradigm entirely.

    Fabric is not just another analytics service — it is a fully unified analytics platform that brings together data engineering, data science, real‑time analytics, business intelligence, and governance under a single architecture. It is built on the principle that modern analytics should be end‑to‑end, integrated, and open, without forcing organizations to maintain dozens of disconnected systems.

    At the heart of Fabric lies OneLake, a single, organization‑wide data lake built on open Delta Lake standards. Every workload in Fabric — Lakehouses, Warehouses, Pipelines, Event Streams, Power BI, Notebooks — operates directly on OneLake. No copies. No synchronization. No refresh cycles. No duplication.

    The Problem Fabric Was Built to Solve

    Before diving into the platform, it’s important to understand the pain points Fabric addresses. Most organizations today face challenges such as:

    • Multiple storage systems (ADLS, S3, Snowflake, on‑prem databases)
    • Data duplication across lakes, warehouses, BI models, and ML environments
    • Complex ingestion pipelines that require custom orchestration
    • Slow refresh cycles for BI dashboards
    • Governance gaps caused by scattered tools
    • High operational overhead from managing separate compute engines
    • Inconsistent security models across services
    • Difficulty scaling real‑time analytics without specialized infrastructure

    Fabric’s design philosophy is simple: One platform. One lake. One security model. One governance layer. One experience.

    This is the foundation of everything Fabric does.

    Why Fabric Represents the Future

    Fabric solves problems that have plagued organizations for years — fragmented systems, data duplication, slow refresh cycles, complex governance, high operational overhead, real‑time analytics complexity, BI performance bottlenecks, and inconsistent security models.

    By unifying everything under one platform, Fabric enables:

    • Faster development
    • Lower costs
    • Better governance
    • Real‑time insights
    • Simplified architecture
    • Higher performance
    • Stronger collaboration
    • Enterprise scalability

    Fabric is not just a new product — it is a new way of thinking about analytics.

    ← Back to Microsoft Fabric — Complete Learning Series

  • OneLake & Direct Lake — The Foundation of Microsoft Fabric

    ← Back to Microsoft Fabric — Complete Learning Series

    If Microsoft Fabric is the house, OneLake is its foundation — and Direct Lake is the breakthrough that makes the whole thing sing. Understanding these two concepts is essential before exploring any other part of Fabric.

    OneLake — The Central, Unified Data Lake

    OneLake is the single most important component of Microsoft Fabric. It is the central, unified data lake for your entire organization, built on top of Azure Data Lake Storage (ADLS) but extended with Fabric‑specific capabilities.

    Key characteristics of OneLake:

    • Organization‑wide storage — Every workspace, every Lakehouse, every Warehouse, every dataset — all stored in OneLake.
    • Open Delta Lake format — Fabric uses Delta tables as the standard for all structured data.
    • No data copies — Power BI, SQL, Spark, and ML workloads all read the same Delta tables.
    • Shortcuts — You can reference external data (ADLS, S3) without copying it.
    • Unified governance — Purview, lineage, sensitivity labels, and access control apply consistently.

    OneLake is not just storage — it is the single source of truth for the entire analytics ecosystem.

    Direct Lake — The Breakthrough Innovation

    Direct Lake is arguably the most revolutionary feature in Fabric. It eliminates the traditional Power BI import/refresh cycle by allowing semantic models to read Delta tables directly from OneLake.

    Why Direct Lake matters:

    • No refreshes — Data is always up‑to‑date.
    • No duplication — BI models do not store separate copies of data.
    • Lightning‑fast performance — Direct Lake is optimized for columnar reads on Delta.
    • Lower storage costs — OneLake holds the data once.
    • Simplified architecture — No need for incremental refresh logic or scheduled jobs.

    Direct Lake transforms Power BI from a BI tool into a real‑time enterprise analytics engine.

    OneLake + Direct Lake Together

    The combination of OneLake and Direct Lake is what makes Fabric genuinely different from previous analytics platforms. Your data lives once, in one place, in an open format — and every tool in the platform reads it directly, without copies, without delays, without synchronization headaches.

    That’s not just an architectural improvement. It’s a fundamentally better way to build analytics systems.

    ← Back to Microsoft Fabric — Complete Learning Series

  • Direct Lake in Microsoft Fabric — The Problem, The Solution & How It Works

    ← Back to Microsoft Fabric — Complete Learning Series

    Introduction — The BI Bottleneck That Held Enterprises Back

    For more than a decade, business intelligence systems have been built around a simple but painful truth: Power BI dashboards need refresh cycles. Whether scheduled hourly, daily, or weekly, refreshes were a necessary evil. They consumed compute, duplicated data, introduced latency, and forced teams to maintain complex incremental refresh logic.

    This model worked—until data volumes exploded, real-time expectations increased, and organizations demanded analytics that were instant, accurate, and always fresh.

    Microsoft Fabric introduces the breakthrough that finally ends this cycle: Direct Lake.

    Direct Lake is not an incremental improvement. It is a fundamental shift in how BI systems operate. It eliminates refreshes entirely, removes data duplication, and allows Power BI semantic models to read Delta tables directly from OneLake with warehouse-grade performance.

    SECTION 1 — The Problem Direct Lake Was Built to Solve

    Before Direct Lake, Power BI had two primary storage modes:

    1. Import Mode

    • Data is copied into Power BI
    • Dashboards rely on cached data
    • Refresh cycles required
    • Incremental refresh logic needed
    • High storage consumption
    • High compute cost for refreshes

    2. DirectQuery Mode

    • No data copies
    • Queries executed live against the source
    • Slow for large datasets
    • High load on the source system
    • Limited DAX capabilities
    • Limited modeling flexibility

    Both modes had strengths—but both had serious limitations.

    SECTION 2 — What Is Direct Lake?

    Direct Lake is a new storage mode in Power BI that allows semantic models to read Delta Lake tables directly from OneLake without importing or querying data through an engine.

    It combines the best of Import and DirectQuery:

    Comparison table:

    FeatureImportDirectQueryDirect Lake
    Data copiesYesNoNo
    Refresh cyclesYesNoNo
    PerformanceFastSlowFast
    Real-timeNoYesYes
    Source loadNoneHighNone
    Storage costHighLowLow

    Direct Lake is the first mode that delivers: No refreshes, No duplication, No source load, High performance, Real-time analytics.

    SECTION 3 — How Direct Lake Works (The Technical Deep Dive)

    To understand Direct Lake, you must understand three core components:

    • 1. OneLake — Fabric’s unified data lake. All workloads operate directly on OneLake.
    • 2. Delta Lake — The open storage format used for structured data. Supports ACID transactions, schema evolution, and high-performance reads.
    • 3. Semantic Models — Power BI’s modeling layer — measures, relationships, hierarchies, RLS/OLS.

    Direct Lake connects these three layers directly.

    The Magic: No Engine Between Power BI and Delta

    In Import mode, Power BI loads data into its internal VertiPaq engine. In DirectQuery mode, Power BI queries the source engine (SQL, Spark, etc.).

    In Direct Lake mode: Power BI reads Delta files directly from OneLake using a high-performance columnar reader optimized for analytics.

    No engine. No duplication. No refresh. No latency. This is why Direct Lake is so fast.

    Active design system:

    Colors

    Colors: black #000000, cyan-bluish-gray #abb8c3, white #ffffff, pale-pink #f78da7, vivid-red #cf2e2e, luminous-vivid-orange #ff6900, luminous-vivid-amber #fcb900, light-green-cyan #7bdcb5, vivid-green-cyan #00d084, pale-cyan-blue #8ed1fc, vivid-cyan-blue #0693e3, vivid-purple #9b51e0, base #FFFFFF, contrast #111111, accent-1 #FFEE58, accent-2 #F6CFF4, accent-3 #503AA8, accent-4 #686868, accent-5 #FBFAF3, accent-6 color-mix(in srgb, currentColor 20%, transparent)

    Fonts

    Fonts: Albert Sans, Alegreya, Arvo, Bodoni Moda, Bricolage Grotesque, Cabin, Chivo, Commissioner, Cormorant, Courier Prime, Crimson Pro, DM Mono, DM Sans, DM Serif Display, Domine, EB Garamond, Epilogue, Fahkwang, Figtree, Fira Sans, Fjalla One, Fraunces, Gabarito, IBM Plex Mono, IBM Plex Sans, Ibarra Real Nova, Instrument Serif, Inter, Josefin Sans, Jost, Libre Baskerville, Libre Franklin, Literata, Lora, Merriweather, Montserrat, Newsreader, Noto Sans Mono, Nunito, Open Sans, Overpass, PT Serif, Petrona, Piazzolla, Playfair Display, Plus Jakarta Sans, Poppins, Raleway, Roboto, Roboto Slab, Rubik, Rufina, Sora, Source Sans 3, Source Serif 4, Space Mono, Syne, Texturina, Urbanist, Work Sans, Manrope, Fira Code

    Element styles

    Element styles: button (color: #FFFFFF, bg: #111111, font: inherit, weight: inherit); h6 (weight: 700); heading (weight: 400); link (color: currentColor)

    Direct Lake Deep Dive Series

    This is Part 1 of 5 in the Direct Lake Deep Dive Series: Direct Lake in Microsoft Fabric — The Problem, The Solution & How It Works.

    Next → Direct Lake — Why It Matters & How It Compares to Import and DirectQuery

    Related Reading

    ← Back to Microsoft Fabric — Complete Learning Series

  • Direct Lake — Why It Matters & How It Compares to Import and DirectQuery

    ← Back to Microsoft Fabric — Complete Learning Series

    Section 4 — Why Direct Lake Matters: The Real Impact

    Direct Lake solves problems that have plagued BI teams for years.

    1. No More Refresh Cycles — Refreshes are gone. Data is always up-to-date.
    2. No More Data Duplication — Power BI does not store a copy of the data. OneLake holds the data once.
    3. No More Complex Incremental Refresh Logic — No partitions. No incremental policies. No scheduled jobs.
    4. No More Source System Load — Direct Lake does not query the source engine. It reads Delta files directly.
    5. Real-Time Analytics — As soon as Delta tables are updated, dashboards reflect the change.
    6. Lower Storage Costs — OneLake stores the data once. Power BI stores metadata only.
    7. Simplified Architecture — No need for: Dataflows, Import datasets, Refresh pipelines, Incremental refresh logic, Duplicate storage layers.
    8. Enterprise Scalability — Direct Lake is designed for: Billions of rows, Large fact tables, High concurrency, Real-time workloads.

    Direct Lake is not just a feature — it is a new BI architecture.

    Section 5 — Direct Lake vs Import vs DirectQuery: The Definitive Comparison

    Import Mode: Best for small to medium datasets. Fast performance. But requires refreshes.

    DirectQuery Mode: Best for real-time scenarios. But slow and limited.

    Direct Lake Mode: Best for large datasets, real-time analytics, and enterprise BI.

    Feature Import DirectQuery Direct Lake
    Refresh required Yes No No
    Real-time No Yes Yes
    Performance High Low High
    Source load None High None
    Data duplication Yes No No
    Storage cost High Low Low
    DAX support Full Limited Full
    Modeling flexibility High Medium High
    Best for Small/medium datasets Operational dashboards Enterprise analytics

    Direct Lake is the clear winner for modern analytics.

    ← Back to Microsoft Fabric — Complete Learning Series

  • USERNAME() to extract the name of the logged-in user in Power BI – Part 2

    USERNAME() to extract the name of the logged-in user in Power BI – Part 2

    USERNAME() and USERPRINCIPALNAME() can be used in various ways. However, In this post, we will look at two Power BI functions, USERNAME() and USERPRINCIPALNAME(). To extract either the first name or the user’s last name, they differ when using Power BI Desktop and Power BI Service.

    We will pick up where we left off in part 1 of this post. As promised, here is the explanation in detail.

    Username
    MyUsername =
    VAR myusername =
        USERNAME ()
    VAR findmyatrate = "@"
    VAR findmyslash = "\"
    VAR totallen =
        LEN ( USERNAME () )
    VAR myname =
        IF (
            FIND ( findmyatrate, myusername, 1, 0 ) = 0,
            RIGHT ( myusername, totallen - FIND ( findmyslash, myusername, 1 ) ),
            LEFT ( myusername, FIND ( findmyatrate, myusername, 1 ) - 1 )
        )
    VAR capfirstchar =
        UPPER ( LEFT ( myname, 1 ) )
    VAR addremchar =
        LOWER ( RIGHT ( myname, LEN ( myname ) - 1 ) )
    VAR comboth = capfirstchar & addremchar
    RETURN
        "Welcome : " & comboth
    

    The behavior of these functions varies. In Power BI Desktop, it shows the local machine name\user name, for example, domain\username. You can find yours easily by going to cmd and typing in whoami. If I was to use \ as a means to find the username, then in Power BI Service, I will have a problem. This is because, in the Power BI Service, it shows username@domain.com. To accommodate for this, we need to search(find) for the index of @.

    Once we know this, the rest of the work is as easy as finding the index value of either @ or \ and counting the correct number of characters from it. But wait, there is more.

    Though we know that the behavior is different in Desktop and Service, we also need to ensure that we use both right and left functions. this is because the user’s name itself will shift the position. As you can see in the example above when in Desktop, the username is on the right (meaning after the \), and in Service, the username is on the left (meaning before the @)

    Once this is done, it is just a matter of checking from which starting position the Find function returns a 0. Wrap this into an IF statement, and it will do the trick. At this point, all the heavy lifting is done.

    To capitalize the first character, once again use left but wrap it around the upper function. This will change the case sensitivity to the upper case. Do the same for the rest of the characters and make when lower.

    Finally, return the function and add a “welcome” or any other greeting if you so desire it, and now you can greet your users who logged in with a nice welcome message.

    Though, I enjoyed working on this. There are a few things that I realized, and you will have to adjust your logic accordingly. The biggest adjustment will need to be made when you do have firstname.lastname@domain.com. Here you will need to extract the first name based on the first occurring. (period) and then do the rest. Overall the same logical reasoning should work just fine.

    I hope you liked this. Let me know what you think or if you have a different approach to this.

  • Quick and easy way to use USERNAME() to extract the name of the logged-in user in Power BI – Part 1

    Quick and easy way to use USERNAME() to extract the name of the logged-in user in Power BI – Part 1

    USERNAME() and USERPRINCIPALNAME() can be used in various ways.

    However, In this post, we will look at two Power BI functions, USERNAME() and USERPRINCIPALNAME(), to extract either the first name or the user’s last name see how they differ when using Power BI Desktop and Power BI Service.

    For this to work, we will need to make use of various string manipulation functions such as LEFT(), RIGHT(), LEN(), and FIND(). Apart from that, you will need to install the Power BI desktop.

    Let us first go over these functions that we will be using to get to our result. If you want to go over the code directly, then please free to go over it at the end of this post.

    Let us begin.

    Username(): Returns the domain name and user name of the current connection with the format of domain-name\user-name. This function does not take any parameter. It returns the username from the credentials given to the system at connection time.

    Left(): Returns the specified number of characters from the start of a text string. This returns a text string containing the specified right-most characters.

    This function fetches the number of characters starting from left.

    Right(): Returns the specified number of characters from the end of a text string. This returns a text string containing the specified right-most characters. Think of this as an equal and opposite of the LEFT() function.

    This function fetches the number of characters starting from right.

    LEN(): Returns the number of characters in a text string. This returns the number of characters in the text string.

    Personally speaking, this is my favorite function as once I know the length of any string, we then have the power to manipulate and extract the data as we see fit.

    FIND(): Returns the starting position of one text string within another text string. FIND is case-sensitive and accent-sensitive. This returns the starting position of the text string that we want to find. There are a few other functions that we can use, which can get us the same result as FIND(). But that is a topic for some other time.

    Now that we have these functions handy, let us begin.

    When we use USERNAME() in the Power BI desktop, it will return the domain name and username from the system’s credentials at connection time. One point to be noted here is that this function DOES NOT take any parameters. For example, if I was to use this function on the Power BI desktop, I will see Domain\username. However, when I publish the report, I will see a fully qualifies username such as username@domain.com.

    So here is a thought, how does one extract just the username when the position of username changes depending on the tool (Desktop vs. Service).

    The trick lies in the fact that we will use Find() within the IF function to check for either “\” or “@” and then, based on the position of this separator( “\ or @”), we will be able to get the right result.

    In the next post, I will go over this formula in detail as this can then modified to use in case when our usernames are abc.def@xyz.com or lastname.firstname@domain.com or LFname@domail.com.

    Regardless of how your company uses the username, using this code and some fancy manipulations, you will extract the information you need.

    USERNAME() Power BI Desktop

    The entire code is as follows and we will go over this logic in the next post.

    MyUsername =
    VAR myusername =
    USERNAME ()
    VAR findmyatrate = "@"
    VAR findmyslash = "\"
    VAR totallen =
    LEN ( USERNAME () )
    VAR myname =
    IF (
    FIND ( findmyatrate, myusername, 1, 0 ) = 0,
    RIGHT ( myusername, totallen - FIND ( findmyslash, myusername, 1 ) ),
    LEFT ( myusername, FIND ( findmyatrate, myusername, 1 ) - 1 )
    )
    VAR capfirstchar =
    UPPER ( LEFT ( myname, 1 ) )
    VAR addremchar =
    LOWER ( RIGHT ( myname, LEN ( myname ) - 1 ) )
    VAR comboth = capfirstchar & addremchar
    RETURN
    "Welcome : " & comboth

    We followed this:

    1. We checked for the @ or \ in the name. (Why?? explanation is in the next post).
    2. Based on our find (FIND()), we extracted the name.
    3. We capitalized the First character of the last name and concatenated the rest.

    Power BI USERNAME() is a function that can get the logged-in username. However, the result of this function varies depending on the tool/component of Power BI. In Power BI Desktop, the result is different than what we will see in the Power BI Service.

    Stay tuned for a detailed explanation for this code. Hope you liked it.

  • Create a histogram in Power BI – Method 1

    Create a histogram in Power BI – Method 1

    Hello all,

    In this series of blog posts, we will look into 2 different ways to create a histogram (bins) in Power BI

    There is no out of the box visualization that currently exists for a histogram. In this post, we will see one way to create your won histograms or bins (another name for it). Let us first talk about the data that we will be using for this post. The sample data can be downloaded here.

    Our sample data contains columns such as employee ID, sale amount, hours, and name of each employee.
    The task that we need to accomplish is to bin the count employees by their efficiency. In other words, we need to find how many employees have X efficiency and how many employees have Y efficiencies so on and so forth.

    We will be taking two approaches to achieve this. Method 1 will create a calculated column in the data table and we will use the SWITCH() function to bin the employees.
    Method 2 will make use of the disconnected table and using the VALUES() DAX function we will find the corresponding employee.


    Let us begin with method 1.

    Click on get data and select the sample file.

    1. At this point, there is no need to transform the data as our data for this exercise is already clean. Once the data is loaded, click on the data/model tab and right-click on the table name and let us first rename it to Main_Data.

    First of all, let us create the following measures. These are Total Sales, Total Hours, and Efficiency.

    • Total Sales is the sum of all the sale amount.
    • Total Hours is the sum of all the hours.
    • Efficiency is Total Sales divided by Total Hours. For Efficiency measure, we will use the DIVIDE() function.  
    • Right-click the table (Main_Data) and click a new measure.
    • Let us call it Total Sales. After the ‘=’ sign, type in SUM(Main_Data[Sale Amt]) and hit enter.
    • As a good practice, immediately click the $ symbol and choose the currency format. (I have USD and I have also comma as thousand separator).

    Repeat the same process for Total Hours. The DAX formula for Total Hours is Total Hours = SUM(Main_Data[Hours]).

    Repeat the same process for Count_Names. The DAX formula for Count_Names is Count_Names = COUNT(Main_Data[Emp Id]).

    Finally, let us create an Efficiency measure by using the following function. Efficiency = DIVIDE([Total Sales], [Total Hours],0).

    Click on the Report Canvas tab and select the matrix visualization from the list of Visualizations. 

    In the Rows field, drag and drop the names. In the Values field, drag and drop the Efficiency.

    As we can see from the visual, 11 Names are corresponding to the efficiency of 100. 

    Now our next task is to bin employees whose efficiency is from 0-10, 11-20, etc. 

    Let us go back to the data/model view and click on the new column under the modeling tab. 

    In the formula bar input the below formula.

    BinCol = 
    
    VAR mylbshr = [Efficiency]
    
    RETURN
                
    SWITCH (
            TRUE (),
            mylbshr <= 10, "<= 10",
            mylbshr > 10
                && mylbshr <= 20, "10 - 20",
            mylbshr > 20
                && mylbshr <= 30, "20 - 30",
            mylbshr > 30
                && mylbshr <= 40, "30 - 40",
            mylbshr > 40
                && mylbshr <= 50, "40 - 50",
            mylbshr > 50
                && mylbshr <= 60, "50 - 60",
            mylbshr > 60
                && mylbshr <= 70, "60 - 70",
            mylbshr > 70
                && mylbshr <= 80, "70 - 80",
            mylbshr > 80
                && mylbshr <= 90, "80 - 90",
            mylbshr > 90
                && mylbshr <= 100, "90 - 100",
            mylbshr > 100, " More than 100"
        )
    
    
    1. Let us break down this formula. 
      • We are declaring a variable and storing the value of the measure ([Efficiency]) in it. 
      • We are then returning the value based on the SWITCH() function.
      • We are saying that if the efficiency is <=10 then return me “<=10” else continue. 
      • This function evaluates all the rows and inputs the value based on this test in the Bin_Col column. 

    Click the Clustered Column Chart icon in the visualizations pane. Drag and drop Bin_Col in the Axis field and Count_Names in the Values field. 

    Histogram

    We have now created histogram/binning in Power BI. In the next blog post, we will create a very similar histogram but using the Disconnected Tables method. Please do let me know what you think of this. 

    Till next time !!!